I’m working on a React Native project with TypeScript, and I’m trying to import an image like this:
Cannot find module '@/assets/image.png' or its corresponding type declarations.ts
I’ve already checked that the image exists at the specified path. How do I resolve this error and properly handle static assets like images in a TypeScript-based project?
Any help would be appreciated!
2
Answers
Create a
index.d.ts
file in thesrc
folder and insert this declaration.Restart the TS Compiler if issue persists.