Skip to content

Commit

Permalink
fix ts
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurbalduini committed Oct 29, 2024
1 parent be58d94 commit d88e457
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export interface UseEnrichedRangePickerFieldPropsParams<
TEnableAccessibleFieldDOMStructure extends boolean,
TError,
> extends Pick<
UsePickerResponse<DateRange<TDate>, TDate, TView, RangeFieldSection, any>,
UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>,
'open' | 'actions'
>,
UseRangePositionResponse {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { PickerOwnerState, PickerValidDate } from '../../models';
import { PickerOwnerState } from '../../models';
import { PickersInputLocaleText } from '../../locales';
import { LocalizationProvider } from '../../LocalizationProvider';

Expand All @@ -14,7 +14,7 @@ export const PickersPrivateContext = React.createContext<PickersPrivateContextVa
*
* @ignore - do not document.
*/
export function PickersProvider<TDate extends PickerValidDate>(props: PickersProviderProps<TDate>) {
export function PickersProvider(props: PickersProviderProps) {
const { contextValue, privateContextValue, localeText, children } = props;

return (
Expand All @@ -26,10 +26,10 @@ export function PickersProvider<TDate extends PickerValidDate>(props: PickersPro
);
}

export interface PickersProviderProps<TDate extends PickerValidDate> {
export interface PickersProviderProps {
contextValue: PickersContextValue;
privateContextValue: PickersPrivateContextValue;
localeText: PickersInputLocaleText<TDate> | undefined;
localeText: PickersInputLocaleText | undefined;
children: React.ReactNode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const usePicker = <
TSection,
TExternalProps,
TAdditionalProps
>): UsePickerResponse<TValue, TDate, TView, TSection, InferError<TExternalProps>> => {
>): UsePickerResponse<TValue, TView, TSection, InferError<TExternalProps>> => {
if (process.env.NODE_ENV !== 'production') {
if ((props as any).renderInput != null) {
warnOnce([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,18 @@ export interface UsePickerParams<
UsePickerViewParams<TValue, TDate, TView, TSection, TExternalProps, TAdditionalProps>,
'additionalViewProps' | 'autoFocusView' | 'rendererInterceptor' | 'fieldRef'
>,
Pick<UsePickerProviderParameters<TValue, TDate>, 'localeText'> {
Pick<UsePickerProviderParameters<TValue>, 'localeText'> {
props: TExternalProps;
}

export interface UsePickerResponse<
TValue,
TDate extends PickerValidDate,
TView extends DateOrTimeViewWithMeridiem,
TSection extends FieldSection,
TError,
> extends Omit<UsePickerValueResponse<TValue, TSection, TError>, 'viewProps' | 'layoutProps'>,
Omit<UsePickerViewsResponse<TView>, 'layoutProps'>,
UsePickerLayoutPropsResponse<TValue, TView> {
ownerState: PickerOwnerState;
providerProps: UsePickerProviderReturnValue<TDate>;
providerProps: UsePickerProviderReturnValue;
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import * as React from 'react';
import { FieldSection, PickerOwnerState, PickerValidDate } from '../../../models';
import { FieldSection, PickerOwnerState } from '../../../models';
import { UsePickerValueResponse } from './usePickerValue.types';
import {
PickersProviderProps,
PickersContextValue,
PickersPrivateContextValue,
} from '../../components/PickersProvider';

export interface UsePickerProviderParameters<TValue, TDate extends PickerValidDate>
extends Pick<PickersProviderProps<TDate>, 'localeText'> {
export interface UsePickerProviderParameters<TValue>
extends Pick<PickersProviderProps, 'localeText'> {
pickerValueResponse: UsePickerValueResponse<TValue, FieldSection, any>;
ownerState: PickerOwnerState;
}

export interface UsePickerProviderReturnValue<TDate extends PickerValidDate>
extends Omit<PickersProviderProps<TDate>, 'children'> {}
export interface UsePickerProviderReturnValue extends Omit<PickersProviderProps, 'children'> {}

export function usePickerProvider<TValue, TDate extends PickerValidDate>(
parameters: UsePickerProviderParameters<TValue, TDate>,
): UsePickerProviderReturnValue<TDate> {
export function usePickerProvider<TValue>(
parameters: UsePickerProviderParameters<TValue>,
): UsePickerProviderReturnValue {
const { pickerValueResponse, ownerState, localeText } = parameters;

const contextValue = React.useMemo<PickersContextValue>(
Expand Down

0 comments on commit d88e457

Please sign in to comment.