question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use of ListItemClasses prop on MenuItem component leads to typescript compilation crash. (No overload matches this call)

See original GitHub issue

Hello 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:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
gerhatcommented, Jul 15, 2020

Same issue here. Thank you @karasavm for pointing out the commit that works.

2reactions
RickCardosocommented, Feb 9, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use of ListItemClasses prop on MenuItem component leads to ...
Use of ListItemClasses prop on MenuItem component leads to typescript compilation crash. (No overload matches this call) #21801.
Read more >
Typescript - 'No overload matches this call' when using ...
I clicked on the suggested Quick fixes and now the MenuItem and its props are underlined. After Quick fixes it looks like this...
Read more >
CHANGELOG.old.md - mui/material-ui - Sourcegraph
The usage of NaN as a CSS property with JSS throws an exception. ... lab components, TypeScript users need to import the following...
Read more >
front-end/node_modules/@material-ui/core/CHANGELOG.md
[Card] Fix TypeScript not recognizing "component" prop (#20179) @rart; [Chip] Fix input ... [MenuItem] Fix prop ListItemClasses (#20377) @netochaves ...
Read more >
No overload matches this call with styled components ...
No overload matches this call in TypeScript is really annoying and there aren't too many solutions around there, though we have a solution!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found