-
-
Notifications
You must be signed in to change notification settings - Fork 302
Post process flow default props #231
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
Conversation
Hold, I have a bug to work out. |
Ok, this is good to go and passes with the material-ui codebase. I have added every case that broke to |
* [flow] remove `type DefaultProps` * [docgen] Remove any flow type casts of default values * flow type casting now built into react-docgen reactjs/react-docgen#231 * ignore docs on theme prop * fixed changed/missing prop docs * unrecognized doc-gen flow type * changes/fixes to doc-gen * re-gen api docs with PR reactjs/react-docgen#231 * Use temp @rosskevin/react-docgen * re-gen docs - optional props should now be correct
horizontal: 'left', | ||
}: Origin), | ||
labelRowsPerPage: ('Rows per page:': Node), | ||
component: ('div': ElementType), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity: What is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casting to ElementType to avoid other flow errors and avoid typing all default props. Just one alternative. BTW We have since removed flow from our codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for explaining.
Yeah in my company we also dropped flow, because it was too hard to keep up and we had to add lots of workarounds and rewrite code just to make flow happy
I posted already in #227, seems this fixes some printing for casts too though |
Fixes #221
Based on the work by @adityavohra7 in #227 (on
master
), I have applied a similar change tov3-dev
with post processing of defaultProps. Props are not required when they are specified indefaultProps
.Further, I added
component_11.js
as a diverse test case taken frommaterial-ui
. It Is an all flow test that exercises required, optional, and parameterized types.Use case: mui/material-ui#9222