Skip to content

Commit

Permalink
build(types): align to internal code style (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl authored Oct 18, 2023
1 parent 80aa63e commit 65f4688
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
7 changes: 4 additions & 3 deletions src/contexts/RootProvider.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -11,7 +10,9 @@ import { SelectRangeProvider } from './SelectRange';
import { SelectSingleProvider } from './SelectSingle';

/** The props of {@link RootProvider}. */
export type RootContext = PropsWithChildren<DayPickerBase>;
export interface RootContext {
children?: ReactNode;
}

/** Provide the value for all the context providers. */
export function RootProvider(props: RootContext): JSX.Element {
Expand Down
9 changes: 5 additions & 4 deletions src/contexts/SelectMultiple/SelectMultipleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const SelectMultipleContext = createContext<

export type SelectMultipleProviderProps = {
initialProps: DayPickerBase;
children: ReactNode;
children?: ReactNode;
};

/** Provides the values for the {@link SelectMultipleContext}. */
Expand Down Expand Up @@ -66,10 +66,11 @@ export function SelectMultipleProvider(
);
}

type SelectMultipleProviderInternalProps = {
/** @private */
export interface SelectMultipleProviderInternalProps {
initialProps: DayPickerMultipleProps;
children: ReactNode;
};
children?: ReactNode;
}

export function SelectMultipleProviderInternal({
initialProps,
Expand Down
13 changes: 8 additions & 5 deletions src/contexts/SelectRange/SelectRangeContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, PropsWithChildren, useContext } from 'react';
import { createContext, ReactNode, useContext } from 'react';

import {
addDays,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -76,9 +77,11 @@ export function SelectRangeProvider(
);
}

type SelectRangeProviderInternalProps = PropsWithChildren<{
/** @private */
export interface SelectRangeProviderInternalProps {
initialProps: DayPickerRangeProps;
}>;
children?: ReactNode;
}

export function SelectRangeProviderInternal({
initialProps,
Expand Down
13 changes: 7 additions & 6 deletions src/contexts/SelectSingle/SelectSingleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -49,10 +49,11 @@ export function SelectSingleProvider(
);
}

type SelectSingleProviderInternal = {
/** @private */
export interface SelectSingleProviderInternal {
initialProps: DayPickerSingleProps;
children: ReactNode;
};
children?: ReactNode;
}

export function SelectSingleProviderInternal({
initialProps,
Expand Down

0 comments on commit 65f4688

Please sign in to comment.