Skip to content
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

[typescript] 'MuiAutocomplete' does not exist in type 'Overrides' #19655

Closed
2 tasks done
blackneonreaper opened this issue Feb 11, 2020 · 4 comments
Closed
2 tasks done
Labels
support: question Community support but can be turned into an improvement typescript

Comments

@blackneonreaper
Copy link

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Compiler Error:

Types of property 'overrides' are incompatible.
Type '{ […], MuiAutocomplete }' is not assignable to type 'Overrides'.
  Object literal may only specify known properties, and 'MuiAutocomplete' does not exist in type 'Overrides'.

Expected Behavior 🤔

const theme = createMuiTheme({
   overrides: {
      MuiAutocomplete: {
          …
      }
});

Steps to Reproduce 🕹

Link: https://codesandbox.io/s/create-react-app-with-typescript-w90k3
see withRoot.tsx

Context 🔦

overwrite theme

Your Environment 🌎

Tech Version
Material-UI v4.9.1
React 16.12.0
Browser chrome
TypeScript 3.7.5
@oliviertassinari oliviertassinari added typescript support: question Community support but can be turned into an improvement labels Feb 11, 2020
@oliviertassinari
Copy link
Member

None of the lab components are included in the Overrides nor Props types. As far as I know, our official answer has been to extend the theme, see https://material-ui.com/guides/typescript/#customization-of-theme.

@blackneonreaper
Copy link
Author

@oliviertassinari thnx that's what i was expecting but ok thnx for the quick reply.

@ChrisBaidoo
Copy link

I put this in my codebase and it solved the issue:
import type {} from "@material-ui/lab/themeAugmentation

Read more in
https://next.material-ui.com/components/about-the-lab/#typescript

@oliviertassinari
Copy link
Member

@ChrisBaidoo Since you point to the docs in v5, note that the Autocomplete is in the core, since v5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement typescript
Projects
None yet
Development

No branches or pull requests

3 participants