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
Type 'null[]' is missing the following properties from type '[Date | undefined, Date | undefined]': 0, 1ts(2739)
dateRangePicker.d.ts(75, 5): The expected type comes from property 'value' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<DateRangePicker> & Pick<Readonly<IDateRangePickerProps> & Readonly<{ children?: ReactNode; }>, "children"> & Partial<Pick<...>> & Partial<...>'
The text was updated successfully, but these errors were encountered:
The error message tells you which types are supported; you may use undefined, but not null. Is there a particular reason you need to use null for the start and end?
There's no particular reason I need to use null, this is simply a result of following the documentation of the DateRangePicker component. It's also used in the code example.
After a quick look at the source code, I initially thought that if I changed it to undefined that it would break the non-null checks. But of course != null is still falsey for undefined. Thanks JavaScript!
Nonetheless, this still causes type errors if following exactly how the documentation does it.
As for the code example... null is actually used in the component state of DateRangePickerExample, but it is never sent to DateRangePicker itself since the example uses the component in an "uncontrolled" manner... yeah I understand that's a bit confusing, perhaps it's worth a small refactor.
adidahiya
changed the title
DateRangePicker value prop has incorrect types
Docs for DateRange show the wrong type (null should be undefined)
Nov 13, 2019
Environment
If possible, link to a minimal repro (fork this code sandbox): https://codesandbox.io/s/blueprint-sandbox-wrskg
The text was updated successfully, but these errors were encountered: