Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use PropsTable #21

Closed
louis-pvs opened this issue Jun 13, 2018 · 7 comments
Closed

Unable to use PropsTable #21

louis-pvs opened this issue Jun 13, 2018 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@louis-pvs
Copy link

Bug Report

getValue this function in <PropsTable> causing error

Describe the bug
Once include PropsTable component in my mdx file it throw error

To Reproduce

  1. Go to Button.mdx
  2. Include PropsTable as describe
  3. See error
Uncaught TypeError: Cannot read property 'replace' of undefined at getValue 

Expected behavior
To see the <PropsTable> with correct props defined in ../lib/Button/index.js

Enviroment

{
  "engines": {
    "node": "8.11.1",
    "npm": "5.7.1",
    "yarn": "1.6.0"
  }
}

Additional context/Screenshots
screen shot 2018-06-13 at 3 32 49 pm
screen shot 2018-06-13 at 3 33 27 pm

@emersonlaurentino
Copy link

emersonlaurentino commented Jun 13, 2018

Hey @louis-pvs I'm having the same problem.

I belive that problem is PropTypes.oneOfType. If you stop use it, the error not is shown.

@pedronauck
Copy link
Member

I didn't try <PropsTable> using oneOfType in prop types, I will see what's happening. Thanks guys ✌️

@pedronauck pedronauck added the bug Something isn't working label Jun 13, 2018
@albinekb
Copy link

albinekb commented Jun 13, 2018

Similar issue with .instanceOf:

propTypes = {
  date: PropTypes.instanceOf(Date),
}

Should I open another issue for this?

@emersonlaurentino
Copy link

@albinekb the problem is similar, so i believe we can keep it here.

these also have the same problem:

propTypes = {
  optionalMessage: PropTypes.instanceOf(Message),
  optionalEnum: PropTypes.oneOf(['News', 'Photos']),
  optionalUnion: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
    PropTypes.instanceOf(Message)
  ]),
  optionalArrayOf: PropTypes.arrayOf(PropTypes.number),
  optionalObjectOf: PropTypes.objectOf(PropTypes.number),
  optionalObjectWithShape: PropTypes.shape({
    color: PropTypes.string,
    fontSize: PropTypes.number
  }),
}

@renatorib
Copy link
Contributor

renatorib commented Jun 14, 2018

I started work on that bug.

@renatorib renatorib self-assigned this Jun 14, 2018
@albinekb
Copy link

albinekb commented Jun 14, 2018

@renatorib I made my own, if you want to have a look: https://gist.github.com/albinekb/f59feb84273279d1d45f603aee8eb496

@renatorib
Copy link
Contributor

Looks great @albinekb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants