Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Next.js next/image 'image' implicity has an 'any' type - how to fix?

$
0
0

I am new to Next.js and TypeScript and cant seem to find any resources on how to fix this issue:

import Image from 'next/image';export default function Item({ image }) { // <-- parameter image needs a 'type' definition?  ...}

but the above gives this notice/warning/error with regard to the parameter image:

Binding element 'image' implicitly has an 'any' type.ts(7031). (parameter) image: any

I understand that TS needs variable types to be defined/declared but I sure as heck have no idea what 'type' NextJS Image should be and I also know that giving it the any type is not the way to go either? How can I fix this issue?

I tried the following but doesn't work:

export default function MealItem({ image: Image }) { // <-- tried the `image: Image` syntax

Does anyone have any resource, documentation, or preferred place to search up what the right type would be for a parameter/function and the right syntax that goes along with it to quell these warnings?

Thanks in advance.


Viewing all articles
Browse latest Browse all 12111

Trending Articles