-1

I have imported Image as follows: import Image from "next/image";

Error:

Type '{ src: string; }' is not assignable to type 'IntrinsicAttributes & ImageProps'.
  Type '{ src: string; }' is not assignable to type 'ObjectImageProps'.
    Types of property 'src' are incompatible.
      Type 'string' is not assignable to type 'StaticImport'.ts(2322)

It seems like it will only accept an image that is imported even if the string I am passing into src is a local path.

EDIT: Because it is a local path, how do I import it dynamically and then pass it into the image?

Shivam
  • 1,345
  • 7
  • 28
  • 3
    Does this help? https://stackoverflow.com/questions/68148204/types-of-property-src-are-incompatible-in-nextjs-image] – Toxnyc Jul 22 '21 at 03:04

1 Answers1

0

When you pass a string as src, you need to provide height and width props as well

Example:

<Image
    src='/image.png'
    width={200}
    height={200}
 />