Skip to content

Commit

Permalink
fix(types): PropsWithChildren not compatible with React 17 (#1947)
Browse files Browse the repository at this point in the history
Co-authored-by: Binh Van Phan <[email protected]>
  • Loading branch information
binhpv and Binh Van Phan authored Oct 18, 2023
1 parent 07bd7f1 commit db260be
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/Months/Months.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PropsWithChildren } from 'react';
import { ReactNode } from 'react';

import { useDayPicker } from 'contexts/DayPicker';

/** The props for the {@link Months} component. */
export type MonthsProps = PropsWithChildren;
export type MonthsProps = { children: ReactNode };

/**
* Render the wrapper for the mont grids.
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/Focus/FocusContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, PropsWithChildren, useContext, useState } from 'react';
import { createContext, ReactNode, useContext, useState } from 'react';

import { isSameDay } from 'date-fns';

Expand Down Expand Up @@ -54,7 +54,7 @@ export const FocusContext = createContext<FocusContextValue | undefined>(
undefined
);

export type FocusProviderProps = PropsWithChildren;
export type FocusProviderProps = { children: ReactNode };

/** The provider for the {@link FocusContext}. */
export function FocusProvider(props: FocusProviderProps): JSX.Element {
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/Modifiers/ModifiersContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, PropsWithChildren, useContext } from 'react';
import { createContext, useContext, ReactNode } from 'react';

import { useDayPicker } from 'contexts/DayPicker';
import { useSelectMultiple } from 'contexts/SelectMultiple';
Expand All @@ -11,7 +11,7 @@ import { getInternalModifiers } from './utils/getInternalModifiers';
/** The Modifiers context store the modifiers used in DayPicker. To access the value of this context, use {@link useModifiers}. */
export const ModifiersContext = createContext<Modifiers | undefined>(undefined);

export type ModifiersProviderProps = PropsWithChildren;
export type ModifiersProviderProps = { children: ReactNode };

/** Provide the value for the {@link ModifiersContext}. */
export function ModifiersProvider(props: ModifiersProviderProps): JSX.Element {
Expand Down
8 changes: 4 additions & 4 deletions src/contexts/SelectRange/SelectRangeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export const SelectRangeContext = createContext<
SelectRangeContextValue | undefined
>(undefined);

type SelectRangeProviderProps = {
type SelectRangeProviderProps = PropsWithChildren<{
initialProps: DayPickerBase;
} & PropsWithChildren;
}>;

/** Provides the values for the {@link SelectRangeProvider}. */
export function SelectRangeProvider(
Expand Down Expand Up @@ -76,9 +76,9 @@ export function SelectRangeProvider(
);
}

type SelectRangeProviderInternalProps = {
type SelectRangeProviderInternalProps = PropsWithChildren<{
initialProps: DayPickerRangeProps;
} & PropsWithChildren;
}>;

export function SelectRangeProviderInternal({
initialProps,
Expand Down

0 comments on commit db260be

Please sign in to comment.