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

Typescript mismatch #1070

Closed
alynnlp opened this issue May 29, 2019 · 9 comments
Closed

Typescript mismatch #1070

alynnlp opened this issue May 29, 2019 · 9 comments

Comments

@alynnlp
Copy link

alynnlp commented May 29, 2019

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<KeyboardDateInputProps, "id" | "is" | "onSubmit" | "error" | "children" | "ref" | "label" | "select" | "style" | "title" | "mask" | "color" | "hidden" | "dir" | "slot" | "name" | ... 263 more ... | "onAuxClickCapture">': 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<PureDateInputProps, "children" | "ref" | "label" | "select" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 263 more ... | "onAuxClickCapture">': ref, key, onAuxClick, onAuxClickCapture

Note: why is it complaining PureDateInputProps ??

@dmtrKovalenko
Copy link
Member

Duplicate of #1025

@dmtrKovalenko dmtrKovalenko marked this as a duplicate of #1025 May 30, 2019
@fmozaffari
Copy link

@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"

@stewartmatheson
Copy link

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

@junrillnzfsg
Copy link

any update on this @dmtrKovalenko ?

@dmtrKovalenko
Copy link
Member

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

@oliviertassinari
Copy link
Member

Is the problem identical to mui/material-ui#18402? Does it help to stick to @material-ui/pickers v3.2.5?

@kingeric027
Copy link

kingeric027 commented Jan 15, 2020

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<PureDateInputProps, "ref" | "label" | "select" | "style" | "title" | "className" | "innerRef" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 268 more ... | "inputVariant">': color,
size TS2739"

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

@dmtrKovalenko
Copy link
Member

@oliviertassinari haha just discussed this issue

@kingeric027
Copy link

@dmtrKovalenko is there any resolution / workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants