-
-
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
[ListItem] Property 'component' does not exist on type #17645
Comments
The error message is wrong, the actual error is that The fix for your code is - React.forwardRef<HTMLAnchorElement, NavLinkProps>((itemProps, ref) => (
+ React.forwardRef<HTMLAnchorElement, Omit<NavLinkProps, 'innerRef' | 'to'>>((itemProps, ref) => (
There is, it's located here https://material-ui.com/guides/composition/#list |
@Graham42 Most demos should be available in TypeScript as well. The demo in question has one and the fix from @merceyz is applied: https://material-ui.com/guides/composition/#ListRouter.tsx |
Well that's extremely frustrating.... Thanks for your help. I guess this is a typescript bug? |
@Graham42 Your codesandbox link uses an outdated version. Check the new one from my comment in #17645 (comment) |
I was referring to the error message being wrong. |
It's more a chicken-egg problem. Given the props: the component is wrong BUT given the component: the props are wrong. Since the component is part of the props it's ambiguous where the error originates |
The example from the docs for composing react-router and material-ui Lists does not work without compile errors. (using my project's version of dependencies which are supposed to be compatible with material-ui)
I found some related issues to this, but they don't seem to be for the
ListItem
component.Related:
Current Behavior 😯
Expected Behavior 🤔
There should be an example of how to use material-ui and react-router together that doesn't have compile errors.
Or... If there's specific versions that are required, they should be documented.
Steps to Reproduce 🕹
Note: It takes a few minutes for the type error to show up in the browser editor.
https://codesandbox.io/s/material-demo-coinv
Context 🔦
It seems like this should be a very common use case. People trying to build a nav which is a list of links. Maybe I'm missing something.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: