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] createPalette and createMuiTheme should accept a DeepPartial<Palette> instead of Partial<Palette> #9333

Closed
1 task done
xaviergonz opened this issue Nov 29, 2017 · 0 comments

Comments

@xaviergonz
Copy link
Contributor

Right now createPalette and createMuiTheme accept a Partial, but actually they should accept a DeepPartial since they do a deepmerge instead of a shallow merge

type DeepPartial<T> = {
  [ P in keyof T ]?: DeepPartial<T[ P ]>;
};
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Using a palette like this should not give type errors:

createPalette({
  shades: {
    dark: {
      text: {
        primary: 'green',
      }
    }
  }
});

Current Behavior

It gives a compilation error, forcing you to cast it to any or to fill in the complete sub-types.

Steps to Reproduce (for bugs)

See code above.

Your Environment

Tech Version
Material-UI latest beta
React 16.2.0
browser Chrome 62
TS 2.6.2
pelotom pushed a commit that referenced this issue Dec 2, 2017
… partial of a pallete (#9368)

Use PaletteOptions = DeepPartial<Palette> for createPalette and createMuiTheme
oliviertassinari pushed a commit to oliviertassinari/material-ui that referenced this issue Dec 3, 2017
…eep partial of a pallete (mui#9368)

Use PaletteOptions = DeepPartial<Palette> for createPalette and createMuiTheme
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