Type '"fill"' is not assignable to type '"fixed" | "intrinsic" | "responsive" | undefined'.
See original GitHub issueWhat version of Next.js are you using?
10.2.3
What version of Node.js are you using?
16.1.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
next start
Describe the Bug
I am using a simple next/image
component:
import Image, { ImageProps } from 'next/image'
export const Img = ({ className = '', ...props }: ImageProps) => (
<div className="unset-img full-bleed">
<Image className={`${className} custom-img`} layout="fill" {...props} />
</div>
)
I get red-squiggly lines on layout
saying:
Type ‘“fill”’ is not assignable to type ‘“fixed” | “intrinsic” | “responsive” | undefined’.
Expected Behavior
It shouldn’t show a TS error.
To Reproduce
Clone this commit, install the dependencies & run the app. VSCode should yell.
The error is in this file. See layout="fill
there.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Type '"fill"' is not assignable to type '"fixed" | "intrinsic" - Reddit
I am trying to use next/image but I am getting an error: Type '"fill"' is not assignable to type '"fixed" | "intrinsic" |...
Read more >NextjS Image issue with src and default external image URL
A little side note too: I've got a Typescript error on the layout property that says "Type '"fill"' is not assignable to type...
Read more >Type 'string or undefined' is not assignable to type string
The "Type 'string | undefined' is not assignable to type string" error occurs when a possibly undefined value is assigned to something that...
Read more >Next.js automatic image optimization with next/image
Learn about automatic image optimization and how it can benefit developers with the native, game-changing, and powerful next/image API.
Read more >Type 'string' is not assignable to type 'TextAlign' - YouTube
Join this channel to get access to perks:https://www.youtube.com/channel/UCoSpmr2KNOxjwE_B9ynUmig/joinMy GearCamera ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found this issue because I’m also experiencing the same problem when I try to pass
preload={true}
prop to the <Image> component.The red-squiggly line disappears if I remove the
preload
prop.Try to use the type below to replace the default ImageProps
In your case, you can do like this