taoqf / node-html-parser

A very fast HTML parser, generating a simplified DOM, with basic element query support.
MIT License
1.12k stars 112 forks source link

Compile error in Angular 9 #142

Closed viperphase1 closed 3 years ago

viperphase1 commented 3 years ago

After installing node-html-parser Angular cannot run the application because of this compile error:

ERROR in node_modules/node-html-parser/dist/nodes/comment.d.ts:17:24 - error TS2693: 'string' only refers to a type, but is being used as a value here.

My tsconfig.json looks like this:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "module": "esnext",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "downlevelIteration": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ],
    "resolveJsonModule": true,
    "esModuleInterop": true
  }
}

Can this be fixed or do I need to change something about my set up?

boukeversteegh commented 3 years ago

You could try to solve this by upgrading typescript.

This worked for me, in a vue 2.x project.

package.json

-   "typescript": "^3.9.9",
+   "typescript": "^4.3.5",