Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Next.js - Type error: Cannot find name 'StaticImageData'

I am trying to push my code to Vercel, it fails in the build steps when checking the validity of the types.

This is the full error received:

info  - Checking validity of types...
Failed to compile.
./node_modules/next/dist/client/image.d.ts:19:14
Type error: Cannot find name 'StaticImageData'.

I tried rolling back the Next.js version to 11, which didn’t work.

Edit:

I found this similar Github issue however it doesn’t seem to have been much help.

https://github.com/vercel/next.js/issues/29788

like image 753
Mac Avatar asked Jul 17 '26 21:07

Mac


1 Answers

As of February 16th 2022 this has been fixed, now you can just import StaticImageData like so:

import { StaticImageData } from "next/image"
like image 121
Dremiq Avatar answered Jul 26 '26 05:07

Dremiq