I'm trying to access window.location.href and document.getElementByID in my > typescript. But getting an error as its undefined.
(node:3024) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: document is not defined
Even tried adding in my tsconfig.json file :
"lib": [
"es6",
"dom"
],
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": [
"node_modules/*",
"src/types/*"
]
}
},
"include": [
"src/**/*"
]
}