-
I am creating a interface ICalendarProps extends DayPickerProps {
...
} However, it produces this typescript warning:
To reproduceNote: I needed to create a Codesandbox "dev box" because the in-browser IDE didn't show typescript errors. In the dev box, in the terminal you can run CodeSandbox: https://codesandbox.io/p/devbox/q4qy2h?migrateFrom=m2j7fr Actual BehaviorIt produces this typescript warning:
Expected BehaviorIt should be possible to extend from Screenshots![]() |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @ts-web, it's not possible to use the E.g.: type CalendarProps = DayPickerProps & { bla: string }; |
Beta Was this translation helpful? Give feedback.
-
Good point. There can be a way to support
However, |
Beta Was this translation helpful? Give feedback.
Hi @ts-web, it's not possible to use the
extends
keyword withDayPickerProps
because it's a Discriminated Union, that is why the TS error happens.You need to use Intersections to extend the
DayPickerProps
type the way you want.E.g.: