-
Notifications
You must be signed in to change notification settings - Fork 21
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
Custom propTypes validators #1
Comments
Turns out I wasn't watching this repository, so sorry about the slow response. This could be done by adding a tag to the JSDoc of the prop you want this validator on and a hook into the |
Currently looking at this again. I wouldn't want to pollute the JSDoc with custom tags. I think a simple mapping pipeline would be sufficient For our use case I would move the text specifying that we need an element accepting a ref to the jsdoc and then check in the generate pipelin if the jsdoc contains this hint. If so then return |
How could I allow custom validators that cannot be expressed with static types?
For example certain components might map+clone their children in which case
React.Fragment
blocks this composition. I would like to validate that none of the children is aReact.Fragment
which is currently impossible to express with TypeScript and needs a custom propTypes validator.The text was updated successfully, but these errors were encountered: