I'm having an issue where I'm trying to compile a TypeScript Node project without DOM types, but TypeScript keeps including the DOM types. Here is my tsconfig.json
:
{
"compilerOptions": {
"lib": [
"ES6"
],
"target": "es6",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
}
}
As you can see, I am using "lib": ["ES6"]
which is suppose to get rid of the DOM types. Using tsc --showconfig
I can verify that this is the config that I am using. However, VSCode's IntelliSense allows me to write out types for the HTML elements, and, on compilation, I get an error talking specifically about a clash with a type in lib.dom.d.ts
, even though the tsconfig
is suppose to exclude them (the ellipses are my own):
node_modules/@types/webgl2/index.d.ts:582:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'WebGL2RenderingContext' must be of type (...), but here has type (...).
582 declare var WebGL2RenderingContext: {
~~~~~~~~~~~~~~~~~~~~~~
C:/Users/username/AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts:16316:13
16316 declare var WebGL2RenderingContext: {
~~~~~~~~~~~~~~~~~~~~~~
'WebGL2RenderingContext' was also declared here.
How can the two definitions of WebGL2RenderingContext
clash if I am excluding DOM types in my tsconfig
?