-
-
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
[Material-ui 4] Typescript: component property does not exist on MenuItem #14970
Comments
@sveyret I can't reproduce the issue. Do you have a reproduction? |
Thank you @oliviertassinari for looking at it. I did not manage to reproduce in CodeSandbox, so I made a minimal project where the compilation fails because of this issue (see its README in order to see how to use it): Note that it is very strange, because if the |
@oliviertassinari I added the yarn.lock file to the project to ensure that versions are the same. I see that the issue is still “incomplete”. Is there anything else I need to provide? |
@eps1lon If I didn't do any mistake with my test, this PR does not correct the problem. |
👍 or 👎 ? |
👎 Issue is not fixed |
The issue is the type definition of your component. You cannot use |
I encountered the same issue (even with
But, I recogniced something strange along that path: If you follow the steps above and if you switch back to ts 3.3.3 (after the error message disappearing) the error won't come back 😮 |
This should be the default case. Every dependency should be listed.
We need to include this in the issue template. We can only help with error messages that are displayed when building your code (via |
@eps1lon Thank you for the information. You can close the issue, then. |
I am having the same issue when trying to pass a component to the ListItem or MenuItem components. I am trying to apply this proposed solution [https://stackoverflow.com/a/55693040/11760100](from Stackoverflow), but I am getting both IDE errors and TypeScript errors when trying to compile.
I am using MUI 4.1.3 with TS 3.5.1 |
Same here with MUI 4.2.1 and TS 3.5.3. |
Same here even with MUI 4.3.1 and TS 3.5.3 |
Do you guys have a reproduction? Could you upvote the issue in this case? |
Please open a separate issue and follow the template. The original issue was fixed and is concerned with an alpha release which we do not support any longer. |
Until PR #16487 is released, there's a workaround if you used a div as component prop previously. Just remove the component completely and replace it by button prop. |
I am testing mui@next. When I try to create a link (through react-router) on a MenuItem, creating a component as the documentation suggests, I have an error saying that porperty 'component' does not exist on type 'IntrinsicAttributes & { action?: ((actions: ButtonBaseActions) => void) | undefined; buttonRef?: ((instance: any) => void) | RefObject | null | undefined; centerRipple?: boolean | undefined; ... 6 more ...; TouchRippleProps?: Partial<...> | undefined; } & { ...; } & { ...; } & CommonProps<...> & Pick<...>'
This was working correctly with mui < v4.0
Note that it seemed to have already appeared and corrected in alpha.3 (#14786)
Code 🕹
Your Environment 🌎
The text was updated successfully, but these errors were encountered: