For either case:
document.getElementById('body');
// or
window.document.getElementById('body');
I get error TS2304: Cannot find name 'window'.
Am I missing something in tsconfig.json
for a definition file I should install?
I get the message when running tsc
and in vscode
tsconfig.json:
{
"compilerOptions": {
"allowJs": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"jsx": "react",
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true,
"target": "ES2016",
"typeRoots": [
"node_modules/@types/",
"typings/index.d.ts"
]
},
"exclude": [
"node_modules",
"**/*-aot.ts"
]
}
My Answer:
For use with tsconfig.json
I target es5
and use lib: ["es2015", "dom"]
tsc
? What is your currenttsconfig.json
file? You need to provide more relevant information if you want help – Piddling