fix: TypeScript type improvements for DatePicker props #6156
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two TypeScript type issues:
minDateandmaxDateprops not available in TypeScript typesselectsMultipletype error when spreading propsChanges
Fix for minDate/maxDate (#6143)
CalendarPropsto useYearDropdownProps(optional) instead ofMonthYearDropdownProps(required) forminDate/maxDateminDate/maxDateoptional inMonthYearDropdownOptionsPropsminDate/maxDatenot provided forMonthYearDropdowncomponentsFix for selectsRange/selectsMultiple spreading (#6131)
selectsRangeandselectsMultiplefrom required literaltrueto optionaltruein the union type branchesboolean | undefined(e.g., from wrapper components usingOmit<DatePickerProps, 'onChange'>)OnChangeSingle,OnChangeRange,OnChangeMultiple) and type assertions to maintain type safetyonChangecallbacksRoot Causes
#6143
In
CalendarProps, the union type forshowMonthYearDropdownwas usingPick<MonthYearDropdownProps, "maxDate" | "minDate">which inherited requiredminDate/maxDate. This caused TypeScript to not properly expose these props.#6131
The
selectsRange: trueandselectsMultiple: truewere typed as required literal types. When users spreadDatePickerProps(e.g.,Omit<DatePickerProps, 'onChange'>), these becomeboolean | undefined, which couldn't be assigned to the literaltrue.Fixes #6143
Fixes #6131
Test plan
🤖 Generated with Claude Code