Skip to content

Conversation

@franklixuefei
Copy link
Contributor

fixes #11853

transitions?: TransitionsOptions;
typography?: TypographyOptions | ((palette: Palette) => TypographyOptions);
zIndex?: ZIndexOptions;
status?: Record<string, string>;
Copy link
Member

@oliviertassinari oliviertassinari Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's too specific.


export interface ThemeOptions {
shape?: ShapeOptions;
shape?: Shape;
Copy link
Member

@oliviertassinari oliviertassinari Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we still need the partial? Like we do for the Spacing.

Copy link
Contributor Author

@franklixuefei franklixuefei Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@franklixuefei franklixuefei Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - if you take a look at shadow type definition under the ThemeOptions interface, it is not Partial<> either.
https://github.com/mui-org/material-ui/blob/ca33d9773581a8b0ff37c92260b48c9f72b42de9/packages/material-ui/src/styles/createMuiTheme.d.ts#L23

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising the issue! Should we fix the implementation over the TypeScript definition then? I have missed this part. I think that spacing and shape should behave the same way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I'll do this. BTW, what about shadows? Should it also be a partial in the ThemeOptions?

Copy link
Member

@oliviertassinari oliviertassinari Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to specify the full props

I don't think that it's the behavior people expect. We need to fix the shape key :).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM. shadows is different.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the shadows, yeah it's fine. Relative values are important, people need to provide the full property.

getContrastText?: (background: string) => string;
}

//export type PaletteOptions = DeepPartial<Palette>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was commented out. Why do we want to preserve the commented out code?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why it was commented out; Let's remove it then :)

transitions: Transitions;
typography: Typography;
zIndex: ZIndex;
status?: Record<string, string>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's too specific.

@oliviertassinari oliviertassinari changed the title [typescript] fixed typings [typescript] Fix typings Jun 27, 2018
@oliviertassinari oliviertassinari added the type: bug It doesn't behave as expected. label Jun 27, 2018
@franklixuefei franklixuefei changed the title [typescript] Fix typings [typescript] [createMuiTheme] Fix typings & deepmerge shape Jun 27, 2018
@oliviertassinari oliviertassinari merged commit 05b59db into mui:master Jun 27, 2018
@oliviertassinari
Copy link
Member

@franklixuefei So many bug fixes in a single pull request 🎉!

@franklixuefei
Copy link
Contributor Author

@oliviertassinari Thanks for taking care of this! I actually left out those two props tonalOffset and contrastThreshold under ThemeOptions. Thanks for adding them!

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

Labels

type: bug It doesn't behave as expected. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants