-
-
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
[react 19] checkPropTypes, ensure runtime warning continuity #43138
Comments
Related: We could update our javascript codesandboxes to check types. Nothing about using javascript prevents us from type checking. Even just adding This improves the DX by a landslide IMO. We can likely just add a
Perhaps we can automate this in the prop types generation script? |
@Janpot The counter-argument is: material-ui/packages/mui-styles/src/styled/styled.js Lines 125 to 130 in b33fca9
material-ui/packages/mui-base/src/Popper/Popper.tsx Lines 350 to 397 in b33fca9
we won't get them with TypeScript, and yet we still need those errors. I'm convinced we need those ones. I would expect without those errors, we will see a flow of support questions, and because as support engineers, we want to have the least amount of work possible, we will actively prioritize adding those checks back for React 19. @atomiks for example for https://github.com/mui/base-ui/blob/fa9f3fa71320d40a409d0318229ec6521fe52e54/packages/mui-base/src/Popover/Positioner/usePopoverPositioner.types.ts#L15, is there a error in case developers provide a DOM node that isn't mounted into the DOM anymore? This used to be a recurring annoying (for me, a support engineer) support question on Material UI. I'm curious to see if developers will complain about this again. Now, do we need all the warnings, I mean for all the props? Yeah, I doubt it. I have added the "waiting for upvotes"s flag, it will help us gather data on this. |
Oh, interesting: https://github.com/facebook/prop-types We might need to create a simpler version of prop-types to solve those DX issues. |
Steps to reproduce
Link to live example: https://codesandbox.io/s/frosty-snowflake-zjl49r?file=/src/Demo.js
Steps:
Toggle the switch
Check the errors
but nothing tells you how to fix it.
Current behavior
No information on what is wrong.
You could argue that TypeScript will let you know ahead of time, but what if you get the type wrong? At least, from this issue, we can collect upvotes from developers who faced the same challenge.
Expected behavior
A clear error message.
Context
Your environment
The text was updated successfully, but these errors were encountered: