-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[docs] Add Pickers TypeScript demos #15103
Conversation
No bundle size changes comparing 264c64d...2e1ded3 |
export type Props = WithStyles<typeof styles>; | ||
|
||
export interface State { | ||
selectedDate: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sperry94 Why was the any
necessary here? Is there maybe some fix we can propose upstream to material-ui-pickers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eps1lon Looks like their typing for date is really just an alias for any
material-ui-pickers date typing file:
date.ts
Created issue mui/material-ui-pickers#970
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will keep an eye on it. I think we should use an actual type here. If we use the correct one an update in material-ui-pickers is fine. If not we get notified with a test failure on update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fill free to use Date
type here.
In pickers we can provide only Moment | Luxon | Date | Dayjs
. That’s one of points that we will change in v3.
But you are using date-fns utility, so you will never get the other types in onChange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eps1lon agreed. I made PR #15144 to use the Date
type in this demo.
@dmtrKovalenko thank you for your help!
Adding TS demos for Picker components as a part of issue #14897