xmldom icon indicating copy to clipboard operation
xmldom copied to clipboard

error TS2304: Cannot find name 'DOMImplementation'

Open ghost opened this issue 6 years ago • 3 comments

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 avatar Jul 24 '17 16:07 ghost

@ghost, add this options to your compilerOptions:

 "lib": [
            "es5",
            "es6",
            "es2016",
            "dom"
        ],

koldoon avatar Aug 20 '18 23:08 koldoon

@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.

pauldraper avatar Mar 08 '19 14:03 pauldraper

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

karfau avatar Jun 28 '20 20:06 karfau