From c23285dae8567fe6d809232cdfd06077aac37321 Mon Sep 17 00:00:00 2001 From: Valerii Sidorenko Date: Thu, 20 Jun 2024 12:12:33 +0200 Subject: [PATCH] fix(BaseSlider): replace ts-expect error with a type assertion --- src/components/Slider/BaseSlider/BaseSlider.tsx | 11 +++++------ src/components/Slider/types.ts | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/Slider/BaseSlider/BaseSlider.tsx b/src/components/Slider/BaseSlider/BaseSlider.tsx index 02b3988020..35a3f1e477 100644 --- a/src/components/Slider/BaseSlider/BaseSlider.tsx +++ b/src/components/Slider/BaseSlider/BaseSlider.tsx @@ -12,17 +12,16 @@ import './BaseSlider.scss'; const b = block('base-slider'); -type BaseSliderProps = {stateModifiers: StateModifiers} & Omit< - SliderProps, +type BaseSliderProps = {stateModifiers: StateModifiers} & Omit< + SliderProps, 'classNames' | 'prefixCls' | 'className' | 'pushable' | 'keyboard' >; export const BaseSlider = React.forwardRef(function BaseSlider( - {stateModifiers, ...otherProps}: BaseSliderProps, - ref: React.ForwardedRef, + {stateModifiers, ...otherProps}, + ref, ) { return ( - // @ts-expect-error Slider value type is (number | number[]) but we use (number | [number, number]) (function keyboard={true} /> ); -}); +}) as (p: BaseSliderProps & {ref?: React.Ref}) => React.ReactElement; diff --git a/src/components/Slider/types.ts b/src/components/Slider/types.ts index a553bab476..30847b9536 100644 --- a/src/components/Slider/types.ts +++ b/src/components/Slider/types.ts @@ -67,7 +67,7 @@ export type SliderProps = { /** The control's tabIndex attribute */ tabIndex?: ValueType; /** Ref to Slider's component props of focus and blur */ - apiRef?: React.RefObject; + apiRef?: React.Ref; 'aria-label'?: string | [string, string]; 'aria-labelledby'?: string | [string, string]; id?: string;