TypeScript: MenuItem does not allow the props needed by a component override
See original GitHub issueCodeSandbox: https://codesandbox.io/s/chakra-ts-starter-s8bur
I came across this when trying to make a TypeScript sandbox for #142.
I think the type should allow the props allowed by the component used in the as
prop. I appreciate this might be a little bit hard to do with TypeScript. I imagine some fun with generics is needed.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Extend material-ui component in typescript - Stack Overflow
And I get this error for no overload match which is obvious because material ui Button component doesn't know about the "fontSize" new...
Read more >MenuItem API - Material UI - MUI
Name Type Default
autoFocus bool false
children node
classes object
Read more >Override or set property to React element - DEV Community
We will build a popup menu with a list of actions. The consumer will only add regular button or anchor elements as children...
Read more >Codegen Guide: Components | Learn Plasmic
The override props allow you to customize this tree of elements exactly as you see fit to make your component come alive. You...
Read more >Input Components - React-admin - Marmelab
Tip: If your interface has to support multiple languages, don't use the label prop. Provide one label per locale based on the default...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think that workaround is too bad.
I think we’d have to use generics, so it’d look something like this:
Ref: https://mariusschulz.com/blog/passing-generics-to-jsx-elements-in-typescript
Formik allows users to use them to pass the type of form data: https://github.com/jaredpalmer/formik/issues/1694
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.Thank you for your contributions.