sajad torkamani

When you want to import files with extensions such as .png, .jpg, or .mp3, TypeScript will probably complain:

Cannot find module '../assets/sounds/correct-sound.mp3' or its corresponding type declarations.ts(2307)

To fix this, create a .d.ts file in your project (e.g., src/index.d.ts) and make sure this file is included in the typeRoots setting of your tsconfig.json). Then add something like this to the .d.ts file.

declare module '*.mp3';

That should get rid of the TypeScript error.

Tagged: TypeScript