Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some issues with parse5 #17

Closed
Xesenix opened this issue Jul 1, 2018 · 4 comments
Closed

Some issues with parse5 #17

Xesenix opened this issue Jul 1, 2018 · 4 comments

Comments

@Xesenix
Copy link

Xesenix commented Jul 1, 2018

After updating to version 3.3.1 i get this errors when trying to build (it doesn't ocure for version 3.2.1).

node_modules/gettext-extractor/dist/html/parser.d.ts(4,35): error TS2694: Namespace '"path-to-project/node_modules/parse5/lib/index"' has no exported member 'DefaultTreeNode'.
node_modules/gettext-extractor/dist/html/parser.d.ts(5,39): error TS2694: Namespace '"path-to-project/node_modules/parse5/lib/index"' has no exported member 'DefaultTreeTextNode'.
node_modules/gettext-extractor/dist/html/parser.d.ts(6,38): error TS2694: Namespace '"path-to-project/node_modules/parse5/lib/index"' has no exported member 'DefaultTreeElement'.

one module where im using has this import:

import { GettextExtractor, JsExtractors } from 'gettext-extractor';

im using typescript version 2.8.3 for building with this command

tsc --module commonjs
@lukasgeiter
Copy link
Owner

In the latest version I've upgraded to version 5 of the parse5 library which seems to be the cause of your issue. Are you also compiling the dist files of this package? Because that's not really necessary since it's already compiled from TypeScript to JavaScript.

In any case, a minimal working example of the problem would greatly help in figuring out what's happening.

@Xesenix
Copy link
Author

Xesenix commented Jul 1, 2018

hmm adding @types/parse5@5.0.0 works for me but you are right that my project should use already compiled version of your library

Also minimal example is just typescript file with:

import { GettextExtractor, JsExtractors } from 'gettext-extractor';

parsed with

tsc --module commonjs

and tsconfig.json like this:

{
  "compilerOptions": {
    "moduleResolution": "node",
    "target": "es6",
    "module":"es6",
    "lib": ["es2015", "es2016", "es2017", "dom"],
    "strict": true,
    "sourceMap": true,
    "declaration": true,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "declarationDir": "dist/types",
    "outDir": "dist/lib",
    "types": [
      "node"
    ],
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "include": ["src"]
}

And no dependency on parse5 becouse when you add dependency "parse5": "^5.0.0" problems doesn't appear anymore as instaling parse5 also installs typedefininitions for it

edit:
it looks that its problem with my tsconfig it was missing "skipLibCheck": true, so sorry about that this issue probably can be closed (alternative is moving @types/parse5 to dependencies)

@Xesenix Xesenix closed this as completed Jul 1, 2018
@lukasgeiter
Copy link
Owner

No worries 😉

I'll consider moving it to dependencies. I didn't really want to install any packages that aren't absolutely necessary but maybe it would be a good idea...

@lukasgeiter
Copy link
Owner

FYI: I've moved the necessary @type packages to dependencies in v3.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants