question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript error 'Property 'hiddenLabel' missing' in KeyboardDatePicker

See original GitHub issue

typescript

Environment

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

  1. 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.
  1. 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
AdamBeddoecommented, Aug 14, 2019

Upgrading @material-ui/core fixed this for me too

0reactions
Pablohackcommented, Sep 23, 2019

Upgrading @material-ui/core fixed this for me too

it is necessary to update material-ui / pickers

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found