creativetimofficial / material-tailwind

@material-tailwind is an easy-to-use components library for Tailwind CSS and Material Design.
https://material-tailwind.com/
MIT License
3.84k stars 321 forks source link

Card/CardHeader/CardBody/CardFooter : xxx is missing the following properties from type 'Pick ' #350

Open d-wojciechowski opened 1 year ago

d-wojciechowski commented 1 year ago

Hello,

Great lib! On version change from 1.2.4 -> 2.0.1 I started to encounter in WebStorm the following error:

TS2739: Type '{ children: Element[]; className: string; }' is missing the following properties from type 'Pick ': nonce, onResize, onResizeCapture

image

Is there anything I am missing from configuration side? I am not very skilled with FE (this is my first attempt ;) ).

Best Regards, Dominik Wojciechowski

curtisknudson commented 1 year ago

I am having this exact same issue on my input component. I am sure it's the same for other components as well. Would love to see this get fixed.

Screenshot 2023-06-09 at 9 51 16 PM
lifeoasis-chudee commented 1 year ago

same issue

Harrylever commented 1 year ago

same issue on Slider component

Harrylever commented 1 year ago

On Vscode I added the following attributes and the error/red squiggly line disappeared: From this:

<Slider
  id="pitch"
  min="0.5"
  max="2"
  defaultValue="1"
  step="0.1"
  color="amber"
  onChange={(e) => {
    setPitch(Number(e.target.value));
  }}
/>

To this:

<Slider
  id="pitch"
  min="0.5"
  max="2"
  defaultValue="1"
  step="0.1"
  color="amber"
  onChange={(e) => {
    setPitch(Number(e.target.value));
  }}
  nonce={undefined}
  onResize={undefined}
  onResizeCapture={undefined}
/>

So I decided to convert it to this:

<Slider
  id="pitch"
  min="0.5"
  max="2"
  defaultValue="1"
  step="0.1"
  color="amber"
  onChange={(e) => {
    setPitch(Number(e.target.value));
  }}
  nonce={undefined}
  onResize={() => {}}
  onResizeCapture={() => {}}
/>

In case someone might want to try this.

HendryXX1 commented 1 year ago

Try updating your packages, in my case, I only had to update typescript to 5.2.2, React to 18.2.0, and @types/react to 18.2.21.