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

Image: No overload matches this call. #4268

Closed
iantrudell opened this issue Apr 20, 2023 · 1 comment
Closed

Image: No overload matches this call. #4268

iantrudell opened this issue Apr 20, 2023 · 1 comment
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@iantrudell
Copy link

iantrudell commented Apr 20, 2023

Describe the bug

When I typecheck my code, I get a type error in the new PrimeReact 9.3.0. It looks like there are 5 new required properties (I think they should be optional with default fallbacks?)

No overload matches this call.
  Overload 1 of 2, '(props: ImageProps | Readonly<ImageProps>): Image', gave the following error.
    Type '{ src: string; width: string; preview: true; downloadIcon: true; rotateRightIcon: true; rotateLeftIcon: true; zoomOutIcon: true; }' is missing the following properties from type 'Readonly<ImageProps>': zoomInIcon, closeIcon
  Overload 2 of 2, '(props: ImageProps, context: any): Image', gave the following error.
    Type '{ src: string; width: string; preview: true; downloadIcon: true; rotateRightIcon: true; rotateLeftIcon: true; zoomOutIcon: true; }' is missing the following properties from type 'Readonly<ImageProps>': zoomInIcon, closeIconts(2769)

Reproducer

https://stackblitz.com/edit/react-rx4x7u?file=src%2FApp.tsx

PrimeReact version

9.3.0

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Chrome 111.0.5563.149

Steps to reproduce the behavior

Use an Image component with the defaults listed in the docs:

import React from 'react'; 
import { Image } from 'primereact/image';

export default function PreviewDemo() {
    return (
        <div className="card flex justify-content-center">
            <Image src="https://primefaces.org/cdn/primereact/images/galleria/galleria10.jpg" alt="Image" width="250" preview />
        </div>
    )
}

Expected behavior

5 icon props should be optional and have default fallbacks

@iantrudell iantrudell added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 20, 2023
@melloware
Copy link
Member

Will review and fix thanks for reporting.

@iantrudell iantrudell changed the title Image: Image: No overload matches this call. Apr 20, 2023
@mertsincan mertsincan self-assigned this Apr 20, 2023
@mertsincan mertsincan added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 20, 2023
@mertsincan mertsincan added this to the 9.3.1 milestone Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants