You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Version 1.7.3: Argument of type 'DateValueType' is not assignable to parameter of type 'SetStateAction<{ startDate: null; endDate: null; }>' #321
I'm working with React 18 and wanted to install this version of the Datepicker. I ran npm install react-tailwindcss-datepicker@1.7.3 and updated the dependencies to match. Then I added the following code to my Tailwind config file:
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?
The point is that the useState hook is given the type DateValueType, and not an object description like {startDate: Date | null, endDate: Date | null}. This makes the type of dateRange be DateValueType, and then using it in value={value} makes the types all match.
Import the DateValueType from the package along with Datepicker:
import Datepicker, { DateValueType } from "react-tailwindcss-datepicker";
Activity
neekfenwick commentedon Dec 2, 2025
You don't show how you set up your
value. I got a similar error when using the kind of syntax shown in your error message.Try:
The point is that the
useStatehook is given the typeDateValueType, and not an object description like{startDate: Date | null, endDate: Date | null}. This makes the type ofdateRangebeDateValueType, and then using it invalue={value}makes the types all match.Import the
DateValueTypefrom the package along withDatepicker: