-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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 #21368
Conversation
* This prop isn't supported. | ||
* Use the `component` prop if you need to change the children structure. | ||
*/ | ||
children?: null; |
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.
children?: null; | |
children?: never; |
would've been better but throws during yarn proptypes
because there's no sensible proptype for it. This works and can be merged. We can improve later.
@@ -30,7 +30,7 @@ The `MuiCardMedia` name can be used for providing [default props](/customization | |||
|:-----|:-----|:--------|:------------| | |||
| <span class="prop-name">children</span> | <span class="prop-type">node</span> | | The content of the component. | | |||
| <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">'div'</span> | Component for rendering image. Either a string to use a HTML element or a component. | | |||
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'div'</span> | The component used for the root node. Either a string to use a HTML element or a 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.
Unfortunate but the prop documentation is only useful if you don't know for what component it is. We'll see if up-to-date ts/prop types are worth more than this documentation.
Details of bundle changes.Comparing: 4e21a1d...f1c9cd1 Details of page changes
|
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.
Nice! I’ve spotted some things I want to change in the prop descriptions too 😁 Will open a PR after this is merged
@@ -3,8 +3,23 @@ import { OverridableComponent, OverrideProps } from '../OverridableComponent'; | |||
|
|||
export interface ContainerTypeMap<P = {}, D extends React.ElementType = 'div'> { | |||
props: P & { | |||
children: NonNullable<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.
Unfortunately, this is a breaking change. null
and undefined
were previously allowed as children
but updating to v4.10.2 breaks code that relies on implicit React.ReactNode
type.
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.
These always logged runtime, dev-only warnings. Though we're considering revisiting required children for v5.
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.
Aha, OK, I've never noticed that warning… Not sure though that the restriction makes sense; it should disallow false
as well and even then it wouldn't prevent rendering Container
without content as an empty string, which is effectively the same, could still be passed.
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.
Sure, but just because a solution isn't perfect doesn't mean we shouldn't try to. The idea was to report the most common mistakes. You can always silence TS by passing <Container>{children!}</Container>
.
core components starting with
C