auto import Link Image not working vscode #30952
-
I set up a nextjs project with typescript, and vscode will not auto import Also if I import Is a nextjs issue? or a vscode issue? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 8 replies
-
I hit this all the time 😅 Typeahead importing works for all my other components and npm packages, except these components from Next. |
Beta Was this translation helpful? Give feedback.
-
@SamyZog do you happen to find any solution for this problem? How about you @brianlovin ? |
Beta Was this translation helpful? Give feedback.
-
Add a typescript declaration file with the following content // someFile.d.ts
import Image from 'next/image'
declare module 'next/image' {
export default Image = Image
} Make sure it's matched by the "include" array in your tsconfig.json file. You can do that with |
Beta Was this translation helpful? Give feedback.
-
Hi. Any idea why this happens, why it won't work, and why we have to do this type declaration? I'm using Webstorm but having the same issue. Asking to see if there's some wrong configuration on my side or this is a thing everybody deals with? This discussion having only 3 answers made me think it might be something I'm doing wrong. |
Beta Was this translation helpful? Give feedback.
-
I have the same problem in VScode, tried the suggested solution but VScode thinks Any suggestions ? |
Beta Was this translation helpful? Give feedback.
-
I am having same issue, I need help |
Beta Was this translation helpful? Give feedback.
Add a typescript declaration file with the following content
Make sure it's matched by the "include" array in your tsconfig.json file.
You should start seeing this
You can do that with
next/link
too.