Skip to content

feat: export domhandler's Element to support instanceof checks #296

New issue

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

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

Already on GitHub? # to your account

Conversation

natterstefan
Copy link
Contributor

@natterstefan natterstefan commented Sep 26, 2021

What is the motivation for this pull request?

It's a feature that resolves what we have discussed here (and suggested by others as well).

What is the current behavior?

Currently, one has to import Element by from domhandler manually, after adding it to the project, while it is already a dependency of this package.

What is the new behavior?

html-react-parser exports the Element type of domhandler already, but not the runtime version of it. This PR fixes it.

Checklist:

  • Tests
  • Documentation
  • Types

I also added another CRA example for TypeScript and linked it in the README.md file.

Related Issues

resolves #252
resolves #221 (most likely too)
resolves #199

Copy link
Owner

@remarkablemark remarkablemark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR @natterstefan, I left some comments but otherwise it looks good!

@remarkablemark remarkablemark added the feature New feature or request label Sep 27, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2021

Codecov Report

Merging #296 (f57d7da) into master (bcf3d57) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #296   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         8    +1     
  Lines          135       153   +18     
  Branches        49        53    +4     
=========================================
+ Hits           135       153   +18     
Impacted Files Coverage Δ
index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcf3d57...f57d7da. Read the comment docs.

Copy link
Owner

@remarkablemark remarkablemark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@remarkablemark
Copy link
Owner

Size Limit:

index.js → dist/html-react-parser.min.js...
created dist/html-react-parser.min.js in 975ms
/usr/local/bin/npx size-limit --json
[
  {
    "name": "dist/html-react-parser.min.js",
    "passed": true,
    "size": 9226,
    "running": 0.07007999999999999,
    "loading": 0.1801953125
  }
]

@remarkablemark remarkablemark merged commit 195ce12 into remarkablemark:master Oct 1, 2021
@remarkablemark
Copy link
Owner

remarkablemark commented Oct 1, 2021

Release 1.4.0

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature New feature or request
Projects
None yet
3 participants