Skip to content

Type of parse is any #1313

Closed
Closed
@DreierF

Description

@DreierF

Expected Behavior

The parse function exported from html-react-parser should have a proper type.

Actual Behavior

Since 5.1.4 the type is any, which basically turns off type checking for the parameters and any processing that happens on the returned value. This used to work in previous versions.

Steps to Reproduce

import parse, { Element } from "html-react-parser";

const html = ...;

const parsed = parse(html, {
    // ^ parse has type any now
  replace(domNode) {
    //      ^ This type was correctly inferred in previous versions
   ...
  },
});

Reproducible Demo

Reproduction in Codesandbox

Environment

  • Version: 5.1.4

Keywords

types, #1305

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions