I have the following piece of code within my .tsx file:
import L from 'leaflet';
import icon from 'leaflet/dist/images/marker-icon.png';
import iconShadow from 'leaflet/dist/images/marker-shadow.png';
And Typescript is complaining about the 2nd and 3rd line. Not only the linter, but the TS compiler itself.
Specifically the linter says that "It cannot find module 'blabla/icon.png' or its corresponding type declarations. However, importing L is ok.
Anyone has any idea why this is happening and how to solve this?
My tsconfig file looks like the following:
{
"compilerOptions": {
"outDir": "./dist/", // path to output directory
"sourceMap": true, // allow sourcemap support
"strictNullChecks": true, // enable strict null checks as a best practice
"module": "esnext", // specify module code generation
"jsx": "react", // use typescript to transpile jsx to js
"target": "es5", // specify ECMAScript target version
"allowJs": true, // allow a partial TypeScript and JavaScript codebase
"baseUrl": ".",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"paths": {
}
},
"include" : ["src"],
"exclude": ["node_modules", "dist", "config", ".vscode"]
}
Thank you in advance.