Spinner - No overload matches this call, passing props to component #2936
Labels
Typescript
Issue or pull request is *only* related to TypeScript definition
Milestone
Describe the bug
We have a component that uses Slider passing SliderProps, triggers below error.
Error
TS2769: No overload matches this call. Overload 1 of 2, '(props: SliderProps | Readonly<SliderProps>): Slider', gave the following error. Type '{ id?: string | undefined; value?: SliderValueType | undefined; min?: number | undefined; max?: number | undefined; orientation?: SliderOrientationType | undefined; ... 286 more ...; onTransitionEndCapture?: TransitionEventHandler<...> | undefined; }' is not assignable to type 'IntrinsicClassAttributes<Slider>'. Types of property 'ref' are incompatible. Type 'LegacyRef<HTMLDivElement> | undefined' is not assignable to type 'LegacyRef<Slider> | undefined'. Type '(instance: HTMLDivElement | null) => void' is not assignable to type 'LegacyRef<Slider> | undefined'. Type '(instance: HTMLDivElement | null) => void' is not assignable to type '(instance: Slider | null) => void'. Types of parameters 'instance' and 'instance' are incompatible. Type 'Slider | null' is not assignable to type 'HTMLDivElement | null'. Type 'Component<SliderProps, any, any>' is missing the following properties from type 'HTMLDivElement': align, addEventListener, removeEventListener, accessKey, and 278 more. Overload 2 of 2, '(props: SliderProps, context: any): Slider', gave the following error. Type '{ id?: string | undefined; value?: SliderValueType | undefined; min?: number | undefined; max?: number | undefined; orientation?: SliderOrientationType | undefined; ... 286 more ...; onTransitionEndCapture?: TransitionEventHandler<...> | undefined; }' is not assignable to type 'IntrinsicClassAttributes<Slider>'. Types of property 'ref' are incompatible. Type 'LegacyRef<HTMLDivElement> | undefined' is not assignable to type 'LegacyRef<Slider> | undefined'.
Omiting ref from SliderProps interface seems to fix the problem.
Reproducer
No response
PrimeReact version
8.1.1
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: