Use of ListItemClasses prop on MenuItem component leads to typescript compilation crash. (No overload matches this call)
See original GitHub issueHello guys and thank you for you awesome lib.
Typescript compiler does not recognize ListItemClasses prop on MenuItem component. The error exists only on Typescript project not on plain js/jsx. (works as expected) It seems that something wrong is happening with Typescript declaration related to ListItemClasses.
The above error presented when i use the ListItemClasses prop.
ERROR
/home/mike/Workspace/list-item-classes/src/MyMenu.tsx
TypeScript error in /home/mkarasavvas/Workspace/list-item-classes/src/MyMenu.tsx(34,39):
No overload matches this call.
The last overload gave the following error.
Type '{ children: string; onClick: () => void; ListItemClasses: { root: string; }; }' is not assignable to type 'IntrinsicAttributes & { button?: true | undefined; } & { alignItems?: "center" | "flex-start" | undefined; autoFocus?: boolean | undefined; button?: boolean | undefined; ... 7 more ...; selected?: boolean | undefined; } & { ...; } & CommonProps<...> & Pick<...>'.
Property 'ListItemClasses' does not exist on type 'IntrinsicAttributes & { button?: true | undefined; } & { alignItems?: "center" | "flex-start" | undefined; autoFocus?: boolean | undefined; button?: boolean | undefined; ... 7 more ...; selected?: boolean | undefined; } & { ...; } & CommonProps<...> & Pick<...>'. TS2769
DETAILS I found that this happened after the commit with hash 242080f08cd8b5a342b86299c58494bd3edce85d (3rd July)
On that commit 65d036e8aab5e0fe9e3efbf788daa8af8db57757 (2nd July) the ListItemClasses works as expected on Typescript.
package.json “dependencies”: { “@material-ui/core”: “^4.11.0”, “@testing-library/jest-dom”: “^4.2.4”, “@testing-library/react”: “^9.5.0”, “@testing-library/user-event”: “^7.2.1”, “@types/jest”: “^24.9.1”, “@types/node”: “^12.12.50”, “@types/react”: “^16.9.43”, “@types/react-dom”: “^16.9.8”, “react”: “^16.13.1”, “react-dom”: “^16.13.1”, “react-scripts”: “3.4.1”, “typescript”: “^3.7.5” },
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:13 (7 by maintainers)
Top GitHub Comments
Same issue here. Thank you @karasavm for pointing out the commit that works.
Same problem here, this really needs to be fixed. I’m wondering how the test did not break: https://github.com/mui-org/material-ui/pull/20377/files