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

Typescript - next/image HOC is returning type error on src #26735

Closed
BrunoQuaresma opened this issue Jun 29, 2021 · 2 comments
Closed

Typescript - next/image HOC is returning type error on src #26735

BrunoQuaresma opened this issue Jun 29, 2021 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@BrunoQuaresma
Copy link

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

12

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

next

Describe the Bug

I have a HOC for the next/image component and the type was working good on nextjs 10 but now, after upgrading to 11, it is returning an error. Unfortunately I was not able to find a solution. Here is a sandbox:
https://codesandbox.io/s/cold-tdd-onubv?file=/src/image.tsx

Expected Behavior

Not having the type error.

To Reproduce

Here is a codesandbox link: https://codesandbox.io/s/cold-tdd-onubv?file=/src/image.tsx

@BrunoQuaresma BrunoQuaresma added the bug Issue was opened via the bug report template. label Jun 29, 2021
@BrunoQuaresma
Copy link
Author

I was able to fix that by removing layout from the type and explicit making src as string.

export type ProfileImageProps = {
  size: Size
  top: number
  left: number
  transitionDelay?: number
  src: string
} & Omit<ImageProps, "width" | "height" | "placeholder" | "blurDataURL" | "layout" | "src">

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants