TypeScript error 'Property 'hiddenLabel' missing' in KeyboardDatePicker
See original GitHub issueEnvironment
Tech | Version |
---|---|
@material-ui/pickers | ^3.2.2 |
material-ui | ^4.2.1 |
React | ^16.8.6 |
Browser | Version 76.0.3809.100 |
Peer library | date-fns ^2.0.0-beta.4 |
Steps to reproduce
- Including
hiddenLabel
prop
margin="normal"
id="mui-pickers-date"
label={label}
value={selectedDate}
onChange={onDateChange}
KeyboardButtonProps={{
'aria-label': 'change date'
}}
hiddenLabel="change date"
/>
leads to React console warning:
Warning: React does not recognize the `hiddenLabel` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `hiddenlabel` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
- Removing
hiddenLabel
prop leads to TypeScript compilation error:
TypeScript error in /Users/sophie.fiset/magnet-fe/magnet-dashboard/src/components/shared/DatePicker.tsx(14,6):
Property 'hiddenLabel' is missing in type '{ margin: "normal"; id: string; label: string | undefined; value: Date | null; onChange: (date: Date | null) => void; KeyboardButtonProps: { 'aria-label': string; }; }' but required in type 'Pick<KeyboardDateInputProps, "label" | "children" | "ref" | "select" | "style" | "title" | "mask" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 273 more ... | "rifmFormatter">'. TS2741
Expected behavior
If passing the prop hiddenLabel
that is expected by TS, there should be no React warning. If omitting the prop, app should still compile.
Actual behavior
I can’t include or exclude 😦 Seems like a “me” problem with my version of Typescript perhaps?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
TypeScript error 'Property 'hiddenLabel' missing' in ... - GitHub
If you accidentally passed it from a parent component, remove it from the DOM element. Removing hiddenLabel prop leads to TypeScript compilation ...
Read more >Material DateTimePicker onChange Typescript mismatch error
Type 'Moment' is missing the following properties from type 'Date': toDateString, toTimeString, toLocaleDateString, toLocaleTimeString, and 35 ...
Read more >KeyboardDatePicker API - Material-UI Pickers
Name Type Default
onChange * (date: DateIOType, value?: string | null) => void
value * ParsableDate
allowKeyboardControl boolean true
Read more >igDatePicker TypeScript typing files missing properties?
Hello,. While trying to use the igDatePicker and trying to set options I keep getting errors. $("#date-from").igDatePicker({ width: "250px",
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Upgrading @material-ui/core fixed this for me too
it is necessary to update material-ui / pickers