Calendar: Improve type declaration using generic types with default parameters #7555
Labels
Typescript
Issue or pull request is *only* related to TypeScript definition
Milestone
Describe the bug
I've encountered a problem while working with the
Calendar
component and creating an uncontrolled wrapper around it. The issue lies in the current type overloading approach used in the type definition:export type CalendarProps = CalendarPropsRange | CalendarPropsMultiple | CalendarPropsSingle;
This implementation makes it difficult to dynamically manage the
selectionMode
without introducing additional boilerplate.Reproducer
https://stackblitz.com/edit/vitejs-vite-7rwuaddq?file=src%2FApp.tsx
System Information
Steps to reproduce the behavior
Expected behavior
I propose replacing the type overloading approach with generic types that include default parameters. This change will enhance the flexibility and usability of the
CalendarProps
type.Example:
The text was updated successfully, but these errors were encountered: