For some reason I'm getting this error error TS2688: Cannot find type definition file for 'dist'
, despite dist
being a folder. Does anyone know why this is happening and what I can do to fix this?
tsconfig:
{
"compilerOptions": {
"target": "es5" ,
"lib": [
"es2019",
"dom"
],
"allowJs": false,
"declaration": true,
"sourceMap": true,
"outDir": "./dist/",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true ,
"noFallthroughCasesInSwitch": true,
"typeRoots": [
"./"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true ,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"compileOnSave": true,
"exclude": ["node_modules/"],
"include": ["main.ts"]
}
This is my folder structure:
"typeRoots": [
"./"
],
Your typeRoots is mapped to your root folder so it will think that ./dist
and ./node_modules
will include definition files which is incorrect. I would suggest putting it in a ./typings
folder to avoid this problem.
glsl.d.ts
file to a folder called ./typings
['./typings']
tsc
and it will no longer complain