Material-ui-pickers: Typescript mismatch

Created on 29 May 2019  路  9Comments  路  Source: mui-org/material-ui-pickers

Environment

| Tech | Version |
| -------------------- | ------- |
| @material-ui/pickers | "^3.0.0", |
| material-ui | "^3.9.2" |
| React | ^16.8.0", |
| Browser | chrome |
| Peer library | ??? | |
with Typescript . | ^3.2.2",|

Steps to reproduce

1st issues

  1. create a keyboardDatePicker component
  2. declare props = keyboardDatePickerProps

Expected behavior

this is whats been declared on /picker/index.d.ts

Actual behavior

Type '{ minDateMessage?: ReactNode; maxDateMessage?: ReactNode; invalidDateMessage?: ReactNode; inputValue?: string | undefined; onError?: ((error: ReactNode, value: any) => void) | undefined; ... 317 more ...; onChange: ((date: any, value?: string | ... 1 more ... | undefined) => void) & ((date: any) => void); }' is missing the following properties from type 'Pick': ref, key, onAuxClick, onAuxClickCapturets(2739)

Note: this also happen to KeyboardTimePickerProps, and i found something weird that TimePickerProps has been produced but has never been used because in /pickers/index.d.ts, timePickerProps has used keyboardTimePickerProps instead.

2nd Issues

  1. create a TimePicker component
  2. declare props = KeyboardTimePickerProps ( as declared from /pickers/index.d.ts )

Expected behavior

it should not complain as its been decalred on /picker/index.d.ts

Actual behavior

Type '{ margin: "normal"; label: string; value: ParsableDate; onChange: ((date: any, value?: string | null | undefined) => void) & ((date: any) => void); }' is missing the following properties from type 'Pick': ref, key, onAuxClick, onAuxClickCapture

Note: why is it complaining PureDateInputProps ??

Most helpful comment

@dmtrKovalenko I don't think this is a dupe of #1025. This issue persists on MUI v4.5.2

All 9 comments

Duplicate of #1025

@dmtrKovalenko I am getting the exact same error.
"@material-ui/core": "^4.5.0"
"@material-ui/pickers": "^3.2.6"
"react": "16.8.5"
"typescript": "^3.4.5"

@dmtrKovalenko I don't think this is a dupe of #1025. This issue persists on MUI v4.5.2

any update on this @dmtrKovalenko ?

The problem is with your typescript or @types/react version

Is the problem identical to https://github.com/mui-org/material-ui/pull/18402? Does it help to stick to @material-ui/pickers v3.2.5?

I am experiencing a very similar issue that has started occurring since upgrading to @material-ui/core 4.8.3. When starting the application I get the following TypeScript Eror:
"Type '{ renderDay: (day: MaterialUiPickersDate, selected: MaterialUiPickersDate, dayInCurrentMonth: boolean) => Element; value: Moment; variant: "static"; onChange: (day: MaterialUiPickersDate) => void; ... 9 more ...; rowsMax: undefined; }' is missing the following properties from type 'Pick': color,
size TS2739"

Currently using
"@material-ui/core": "^4.8.3",
"@material-ui/pickers": "^3.2.8",
"react": "16.8.6",
"typescript": "3.4",

@oliviertassinari haha just discussed this issue

@dmtrKovalenko is there any resolution / workaround?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

idrm picture idrm  路  3Comments

brett-patterson picture brett-patterson  路  3Comments

sakulstra picture sakulstra  路  3Comments

danmce picture danmce  路  3Comments

Harasz picture Harasz  路  3Comments