xmldom
xmldom copied to clipboard
error TS2304: Cannot find name 'DOMImplementation'
Hi there, I got this error when compiling:
>tsc --lib ES2015 app3
node_modules/@types/xmldom/index.d.ts(13,16): error TS2304: Cannot find name 'DOMImplementation'.
node_modules/@types/xmldom/index.d.ts(26,64): error TS2304: Cannot find name 'Document'.
node_modules/@types/xmldom/index.d.ts(30,33): error TS2304: Cannot find name 'Node'.
tsconfig.json
{
"compilerOptions": {
"target": "es6",
//"watch": true,
"module": "commonjs",
//"moduleResolution": "node",
//"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true
//"allowJs": true,
//"removeComments": false,
//"noImplicitAny": true,
//"suppressImplicitAnyIndexErrors": true,
//"allowSyntheticDefaultImports": true
//"noEmitOnError": false,
//"preserveConstEnums": true
//,"typeRoots": [
// "./node_modules/@types/"
//]
//,"types" : [ "node", "locutus" ] //, "jasmine", "core-js"
}
//"compileOnSave": true,
//"exclude": [
// "./node_modules/*"
//]
}
David
@ghost, add this options to your compilerOptions:
"lib": [
"es5",
"es6",
"es2016",
"dom"
],
@koldoon that brings in a bunch of incorrect typings though.
It says a whole bunch of things exist on the global object (name, alert, blur, etc.) that do not.
And then I loose type safety.
Since the types for this project are not maintained here but in https://github.com/DefinitelyTyped/DefinitelyTyped this one should be closed as it has been reported as https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26745
(Maintenance has been picked up for the project in https://github.com/xmldom/xmldom, so there is a chance that stuff get's fixed at some point.)
PS: I files a PR with a fix today and it can also be used as a workaround