-
-
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
[docs] Move more prop docs into IntelliSense #21002
Conversation
Details of bundle changes.Comparing: 4e12b95...07f7327 Details of page changes
|
@@ -470,10 +474,9 @@ ButtonBase.propTypes = { | |||
*/ | |||
TouchRippleProps: PropTypes.object, | |||
/** | |||
* Used to control the button's purpose. | |||
* This prop passes the value to the `type` attribute of the native button component. | |||
* @ignore |
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.
With our types it would require more work to get JSDOC working. type
is only considered when component="button"
. It has different types depending on the component
so we can't just slap it into props with type: React.ButtonHTMLAttributes['type']
.
It was also too narrow previously. I'd say this is fine since the documentation value is pretty low. I doubt this is only used after reading about it here.
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. | | ||
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'nav'</span> | The component used for the root node. Either a string to use a HTML element or a component. By default, it maps the variant to a good default headline component. | |
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.
Would require a lot of type gymnastics to get this back as far as I can tell. I don't think this documentation adds anything because it's implicit: Obviously we want to choose a "good default". The question is what this default is and we have that already answered in the default column. Then you ask: "But why this default value?" and "Because it's good" is not a meaningful answer.
/** | ||
* The icon element. | ||
*/ | ||
icon?: React.ReactNode; |
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.
To sync with propTypes. I don't see a reason to disallow arrays or booleans from conditional rendering.
/** | ||
* Element placed before the children. | ||
*/ | ||
startIcon: PropTypes.node, | ||
/** | ||
* @ignore | ||
*/ | ||
type: PropTypes.string, | ||
type: PropTypes.oneOfType([PropTypes.oneOf(['button', 'reset', 'submit']), PropTypes.string]), |
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.
Some redundant checks due to intersecting button#type
with a#type
. But we don't document it explicitly anyway so this seems ok-ish.
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.
Also: This is actually a fix since it was too narrow when you used the component
prop e.g. <Button component="a" type="some/mimetype" />
or <Button component={MyButtonHandlingArbitraryTypes} type="arbitrary" />
would issue false positive runtime warnings.
@@ -37,7 +37,7 @@ CardContent.propTypes = { | |||
* The component used for the root node. | |||
* Either a string to use a HTML element or a component. | |||
*/ | |||
component: PropTypes.elementType, | |||
component: PropTypes /* @typescript-to-proptypes-ignore */.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.
Proptypes arent't generated yet. It's just in preparation of future work and was easy to find&replace.
Not doing all components in one go. We already had some regression in the previous PRs. Easy to make mistakes if you're mindlessly c&p JSDOC.
generateProptypes
now has a list of unfinished components.TODO:
[ ] per-component documentation forSee [docs] Move more prop docs into IntelliSense #21002 (comment)component