I am using Typescript (4.1.3) and I started using custom paths in tsconfig.json. Ever since, when I import any .ts file, if I dont use the whole path , I get the error:
Error:(138, 33) TS2307: Cannot find module 'pages/foo/bar' or its corresponding type declarations.
To fix that I must add the prefix 'src/', so I get 'src/pages/foo/bar'. The project itself works fine, even with this TS Error.
Here is my tsconfig.json file
{
"compilerOptions": {
"allowJs": true,
"sourceMap": true,
"target": "es6",
"strict": true,
"declaration": false,
"noImplicitAny": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "esnext",
"moduleResolution": "node",
"strictNullChecks": false,
"baseUrl": ".",
"paths": {
"foo": [
"bar.js"
]
},
"types": [
"quasar",
"node",
"cypress"
],
"lib": [
"es2018",
"dom"
]
},
"exclude": [
"node_modules"
],
"extends": "@quasar/app/tsconfig-preset"
}