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

[styles] Infer optional props argument for makeStyles in TypeScript #13815

Merged
merged 2 commits into from
Dec 5, 2018

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Dec 5, 2018

Continues #13801.

Enables omission of the props argument in the returned hook function if no props are referenced in the styles argument for makeStyles.

Whenever the typechecker infers that the type of the props is any we make the argument optional. If people would explicitly annotate the props used in makeStyles then they could've already passed undefined.

@eps1lon eps1lon added typescript package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. labels Dec 5, 2018
@eps1lon eps1lon force-pushed the fix/styles/makeStyles/optional-props branch from ca668d5 to 7a9a332 Compare December 5, 2018 17:33
@eps1lon eps1lon merged commit b62b266 into mui:master Dec 5, 2018
@eps1lon eps1lon deleted the fix/styles/makeStyles/optional-props branch December 5, 2018 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant