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

[theme] Fix types to pass array for spacing #20486

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/material-ui/src/styles/createSpacing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export interface Spacing {
): string;
}

export type SpacingOptions = number | ((factor: number) => string | number);
export type SpacingOptions = number | ((factor: number) => string | number) | number[];
Copy link
Member

Choose a reason for hiding this comment

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

If I understand the implementation that this is just forwarded to @material-ui/system, right? Seems like we should type createUnarySpacing at some point and use that type in /core.

Copy link
Member

Choose a reason for hiding this comment

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

Should we do this change here?

Copy link
Member

Choose a reason for hiding this comment

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

I don't feel strongly about it. Up to anybody who's interested in either method.

Copy link
Member

@oliviertassinari oliviertassinari Apr 10, 2020

Choose a reason for hiding this comment

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

Cool, I suggest one step at the time in this case :). @denys-pavlenko Feel free to send a follow-up. Maybe we should start by breaking down the index.d.ts to be closer to the source
https://github.com/mui-org/material-ui/blob/master/packages/material-ui-system/src/index.d.ts
?


export default function createSpacing(spacing: SpacingOptions): Spacing;