Question
Cannot find module 'file-name.png' or its corresponding type declarations - typescript react
i'm trying to import a png in my typescript react project like so:
import logo from 'assets/Logo.svg';
I'm getting this TS error though:
Cannot find module 'assets/Logo.svg' or its corresponding type declarations.ts(2307)
Any idea why this is? I have attached my tsconfig.json
file below in case I have configured something incorrectly:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": "src"
},
"include": ["src"]
}