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 - Lack of index signature in interface ThemeOptions #12189

Closed
2 tasks done
benjaminbours opened this issue Jul 18, 2018 · 3 comments
Closed
2 tasks done

Typescript - Lack of index signature in interface ThemeOptions #12189

benjaminbours opened this issue Jul 18, 2018 · 3 comments
Assignees

Comments

@benjaminbours
Copy link

  • This is a v1.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I would like to add additional variables to a theme so I can use them everywhere, like describe here. So i expected Typescript to compile this for exemple:

const themeOptions: ThemeOptions = {
  custom: {
        black: "#000000"
    },
    palette: {
...

Current Behavior

I got this error when Typescript compile:

Object literal may only specify known properties, and 'custom' does not exist in type 'ThemeOptions'.

Your Environment

I can share my tsconfig.json or more if you want but I think just adding

[propName: string]: any;

in the interface ThemeOptions should fix the problem.

Tech Version
Material-UI 1.4.0
React 16.4.0
@oliviertassinari
Copy link
Member

@benjaminbours
Copy link
Author

benjaminbours commented Jul 18, 2018 via email

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 18, 2018

@benjaminbours Awesome. We are always looking forward to improving the TypeScript support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants