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

Sharing proptypes between components #111

Open
andyearnshaw opened this issue Mar 24, 2017 · 4 comments
Open

Sharing proptypes between components #111

andyearnshaw opened this issue Mar 24, 2017 · 4 comments

Comments

@andyearnshaw
Copy link

I have some common proptypes that I want to maintain in a single place as a constant:

export default const PROPTYPE_THEME = PropTypes.oneOf([
    'default', 'primary', 'white', 'blue', 'purple', 'pink', 'orange', 'green', 'red'
]);

If I add more themes, I only need to edit this one file and not every component. However, I can no longer change it in BlueKit, because it's detected as a "custom" property. It would be handy if BlueKit could either:

  • Trace the variable back to its declaration (through imports) to see if it's a PropType declaration; or
  • Add a codeblock for modifying "custom" PropTypes.
@andyearnshaw
Copy link
Author

andyearnshaw commented Mar 24, 2017

Option 1 requires an improvement in react-docgen: reactjs/react-docgen#33. Option 2 may still be doable.

@alexcastillo
Copy link

+1

1 similar comment
@pasupuletics
Copy link

👍

@chris-allnutt
Copy link

+1 just got surprised this, was sad it doesn't work since you can get similar enforcement with typescript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants