-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[core] Fix prop-types generation #38831
Conversation
Netlify deploy previewhttps://deploy-preview-38831--material-ui.netlify.app/ Bundle size report |
172e348
to
a17b4b7
Compare
} | ||
|
||
// handle component factories: x = createComponent() | ||
if ( | ||
checkDeclarations && | ||
node.initializer && | ||
!isStyledFunction(node) && |
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.
Before getJSXLikeReturnValueFromFunction
did not recognize React.ReactNode
as a valid JSX response, so styled
components were ignored.
Now they are supported, but we probably don't want them to be so I added a test to filter them out.
a17b4b7
to
043d547
Compare
043d547
to
0f2c71a
Compare
@@ -0,0 +1,29 @@ | |||
// eslint-disable-next-line no-restricted-imports -- importing types | |||
import { InternalStandardProps as StandardProps } from '@mui/material'; |
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.
The name was wrong (tsx
instead of ts
) so the props were considered external (maybe we could loosen the implementedBySelfPropsFile
variable in generateProptypes
// Any components that are created by a factory function, e.g. System Box | Container | Grid. | ||
getFromProp(node); | ||
} else { |
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.
Allow to handle nested react.memo(react.forwardRef(...))
@@ -250,14 +265,13 @@ function getPropsFromVariableDeclaration({ | |||
}); | |||
} | |||
} | |||
|
|||
return 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.
Make sure that we test the createX
pattern for all components, otherwise we might miss some
All right, it works great now for me. |
@michaldudak done 👌 |
fb29229
to
af183e7
Compare
See #38517 (comment) for more context
All the problematic component should not correctly be generated, except the slider slots (but for me that's normal)