-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Module '"../@types/domhandler"' has no exported member #231
Comments
@fabienbranchel can you import the types without using import { Comment, ProcessingInstruction, Text } from 'html-react-parser'; See index.d.ts. |
I tried, it's not resolving the issue. |
So domhandler exports its own types so installing Can you provide a reproducible example using CodeSandbox? |
FixHey I got the same Issue. I think the fix would be adding domhandler ^4.0.0 as a dependency. ExplanationThe problem seems to be that this package uses "domhandler" directly but does not have it as a direct dependency. It only has it as an indirect dependency via "html-dom-parser". This can cause problems with the way npm installs packages. If another package requires an older version of "domhandler" and is installed first it will be placed at the root level of node_modules. Since this package does not have an explicit dependency on "domhandler" it will use what is installed at the root level. That "html-dom-parser" uses the required newer version does not help since this version is now placed inside "html-dom-parser".
WorkaroundThe installation of the old "domhandler" 3.0.0 is actually triggered by the dependencies of this module. This means that the only other workaround would be adding "domhandler" ^4.0.0 before "html-react-parser" in the dependencies so it ends up at the root level. |
added missing dependency for "domhandler": "^4.0.0"
@kfritsch Thanks for opening the PR. I left some comments. |
@fabienbranchel @kfritsch I'll make a release later tonight for #240 |
Published v1.2.5: npm: npm i [email protected] Yarn: yarn add [email protected] |
Expected Behavior
Run OK
Actual Behavior
Run KO
Steps to Reproduce
When used with TypeScript (4.1.5), it's suggest to install
@types/domhandler
and@types/htmlparser2
.It's fine. But when it's done, I've got these errors :
Environment
The text was updated successfully, but these errors were encountered: