Next.js: next/image doesn't accept a layout prop, but the docs say it does

Created on 4 Nov 2020  路  4Comments  路  Source: vercel/next.js

Bug report

Describe the bug

I'm using the next/image component with TypeScript and getting this TS error when I try to set the layout prop:

Property 'layout' does not exist on type '(IntrinsicAttributes & Pick<DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "slot" | ... 259 more ... | "onTransitionEndCapture"> & { ...; } & { ...; }) | (IntrinsicAttributes & ... 2 more ... & { ...; })'

The docs claim:

unsized - Deprecated When true, the width and height requirement can by bypassed. Use the layout property instead!

My next version is 10.0.0:

image

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Import the next/image component in a Next + TS project.
  2. Try to set its layout prop.
  3. Observe that there's no intellisense for accepted values, and TypeScript throws an error.

Expected behavior

See docs.

System information

  • OS: Windows
  • Browser (if applies): Chrome
  • Version of Next.js: 10.0.0
bug

Most helpful comment

@timneutkens I upgraded next version to 10.0.1 and still got the exact same error

image

All 4 comments

You need to upgrade to 10.0.1.

@timneutkens I upgraded next version to 10.0.1 and still got the exact same error

image

@timneutkens I upgraded next version to 10.0.1 and still got the exact same error

image

Yeah, version 10.0.1 still does not recognize layout prop.

@timneutkens please, open this issue again, just tried with versions 10.0.1 and 10.0.2-canary.2 and both still can't find that prop.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

swrdfish picture swrdfish  路  3Comments

jesselee34 picture jesselee34  路  3Comments

sospedra picture sospedra  路  3Comments

knipferrc picture knipferrc  路  3Comments