react-tailwindcss-datepicker icon indicating copy to clipboard operation
react-tailwindcss-datepicker copied to clipboard

Version 1.7.3: Argument of type 'DateValueType' is not assignable to parameter of type 'SetStateAction<{ startDate: null; endDate: null; }>'

Open tchangqikr opened this issue 6 months ago • 0 comments

I'm working with React 18 and wanted to install this version of the Datepicker. I ran npm install [email protected] and updated the dependencies to match. Then I added the following code to my Tailwind config file:

content: [
        "./src/**/*.{js,jsx,ts,tsx}",
        "./node_modules/react-tailwindcss-datepicker/dist/index.esm.js"
    ]

Since I'm working with ES modules, the format ended up being more like

export default {
  content: [
        './src/**/*.{js,ts,jsx,tsx}', 
        "./node_modules/react-tailwindcss-datepicker/dist/index.esm.js"
  ],

When I try to implement the Datepicker with the following snippet:

<Datepicker value={value} onChange={newValue => setValue(newValue)} />

I get the following error:

Argument of type 'DateValueType' is not assignable to parameter of type 'SetStateAction<{ startDate: null; endDate: null; }>'.
  Type 'null' is not assignable to type 'SetStateAction<{ startDate: null; endDate: null; }>'.ts(2345)

Not really sure what to do from here, since I followed the setup as best I could. Do you have any ideas?

tchangqikr avatar Jun 18 '25 22:06 tchangqikr