-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Annotate callback parameters #2417
Comments
I like the first example. For the second example, I'm not sure this is supported by react-docgen: to try. |
Yeah, i noticed that functionality was missing myself the other day while looking at it. For material-ui we need it already to support the custom prop types in I have no idea how much work it would be to hack react-docgen into supporting it. sounds easy, but... hehe. im not a terribly good js developer, for one :) |
@oliviertassinari We shouldn't check the provided callback to see if it's correct. Because people might want to pass a function that takes nothing for the purpose of only knowing about the event, or takes a lot of other things. I like the second example more though. we can really extend it good with doctrine. Checkout how awesome it is :D Oliver it's easy to just pass the description text to that lib to get a json structure so we can generate our own way of representing the callbacks. what do you say? we can use |
@alitaheri Wow, doctrine looks awesome. |
@oliviertassinari Thanks 😁 I'll try to tackle with it a bit to see how we should use the output and generate proper signature documentation. We definitely need this 👍 👍 |
We have chosen to implement solution n°2. |
Oooh right... there's that... |
Well, that's not a priority for me 😁. |
I've got it, don't worry 😁 |
Please refer to #3096 now. |
So, I know the React world hasn't really embraced this yet - somehow all functions are equal for the prop types. I wanted to bring this up since you are doing a pass over/inlining the documentation anyway. Would you consider enforcing/documenting callback parameters while you're at it?
ideally we could write custom prop types for functions:
Or alternatively, there would be some value in a textual description too :
Or whatever else have you that already exists in some form. I would definitely be willing to help out here if you agree it's a good idea.
The text was updated successfully, but these errors were encountered: