Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spinner - No overload matches this call, passing props to component #2936

Closed
MitjaNucic opened this issue May 27, 2022 · 1 comment · Fixed by #2937
Closed

Spinner - No overload matches this call, passing props to component #2936

MitjaNucic opened this issue May 27, 2022 · 1 comment · Fixed by #2937
Assignees
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@MitjaNucic
Copy link

Describe the bug

We have a component that uses Slider passing SliderProps, triggers below error.

export type SliderInterface = SliderProps

export const Slider = ({, ...props }: SliderInterface) => {
 return <PrimeReactSlider {...props} />;
};

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

@MitjaNucic MitjaNucic added the Type: Bug Issue contains a defect related to a specific component. label May 27, 2022
melloware added a commit to melloware/primereact that referenced this issue May 27, 2022
@melloware melloware self-assigned this May 27, 2022
@melloware melloware added this to the 8.2.0 milestone May 27, 2022
melloware added a commit to melloware/primereact that referenced this issue May 27, 2022
@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition and removed Type: Bug Issue contains a defect related to a specific component. labels May 27, 2022
@melloware
Copy link
Member

Thanks for the report. Fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants