diff --git a/src/contexts/RootProvider.tsx b/src/contexts/RootProvider.tsx index 6c2c35254e..6a216b7574 100644 --- a/src/contexts/RootProvider.tsx +++ b/src/contexts/RootProvider.tsx @@ -1,7 +1,6 @@ -import { PropsWithChildren } from 'react'; +import { ReactNode } from 'react'; import { ModifiersProvider } from 'contexts/Modifiers/ModifiersContext'; -import { DayPickerBase } from 'types/DayPickerBase'; import { DayPickerProvider } from './DayPicker'; import { FocusProvider } from './Focus'; @@ -11,7 +10,9 @@ import { SelectRangeProvider } from './SelectRange'; import { SelectSingleProvider } from './SelectSingle'; /** The props of {@link RootProvider}. */ -export type RootContext = PropsWithChildren; +export interface RootContext { + children?: ReactNode; +} /** Provide the value for all the context providers. */ export function RootProvider(props: RootContext): JSX.Element { diff --git a/src/contexts/SelectMultiple/SelectMultipleContext.tsx b/src/contexts/SelectMultiple/SelectMultipleContext.tsx index 537108369a..8c48757794 100644 --- a/src/contexts/SelectMultiple/SelectMultipleContext.tsx +++ b/src/contexts/SelectMultiple/SelectMultipleContext.tsx @@ -38,7 +38,7 @@ export const SelectMultipleContext = createContext< export type SelectMultipleProviderProps = { initialProps: DayPickerBase; - children: ReactNode; + children?: ReactNode; }; /** Provides the values for the {@link SelectMultipleContext}. */ @@ -66,10 +66,11 @@ export function SelectMultipleProvider( ); } -type SelectMultipleProviderInternalProps = { +/** @private */ +export interface SelectMultipleProviderInternalProps { initialProps: DayPickerMultipleProps; - children: ReactNode; -}; + children?: ReactNode; +} export function SelectMultipleProviderInternal({ initialProps, diff --git a/src/contexts/SelectRange/SelectRangeContext.tsx b/src/contexts/SelectRange/SelectRangeContext.tsx index a9d3d79960..cb171fb1e1 100644 --- a/src/contexts/SelectRange/SelectRangeContext.tsx +++ b/src/contexts/SelectRange/SelectRangeContext.tsx @@ -1,4 +1,4 @@ -import { createContext, PropsWithChildren, useContext } from 'react'; +import { createContext, ReactNode, useContext } from 'react'; import { addDays, @@ -44,9 +44,10 @@ export const SelectRangeContext = createContext< SelectRangeContextValue | undefined >(undefined); -type SelectRangeProviderProps = PropsWithChildren<{ +export interface SelectRangeProviderProps { initialProps: DayPickerBase; -}>; + children?: ReactNode; +} /** Provides the values for the {@link SelectRangeProvider}. */ export function SelectRangeProvider( @@ -76,9 +77,11 @@ export function SelectRangeProvider( ); } -type SelectRangeProviderInternalProps = PropsWithChildren<{ +/** @private */ +export interface SelectRangeProviderInternalProps { initialProps: DayPickerRangeProps; -}>; + children?: ReactNode; +} export function SelectRangeProviderInternal({ initialProps, diff --git a/src/contexts/SelectSingle/SelectSingleContext.tsx b/src/contexts/SelectSingle/SelectSingleContext.tsx index e81cb8c1e1..d4b4f0d4db 100644 --- a/src/contexts/SelectSingle/SelectSingleContext.tsx +++ b/src/contexts/SelectSingle/SelectSingleContext.tsx @@ -22,10 +22,10 @@ export const SelectSingleContext = createContext< SelectSingleContextValue | undefined >(undefined); -type SelectSingleProviderProps = { +export interface SelectSingleProviderProps { initialProps: DayPickerBase; - children: ReactNode; -}; + children?: ReactNode; +} /** Provides the values for the {@link SelectSingleProvider}. */ export function SelectSingleProvider( @@ -49,10 +49,11 @@ export function SelectSingleProvider( ); } -type SelectSingleProviderInternal = { +/** @private */ +export interface SelectSingleProviderInternal { initialProps: DayPickerSingleProps; - children: ReactNode; -}; + children?: ReactNode; +} export function SelectSingleProviderInternal({ initialProps,