remarkablemark/html-react-parser

Type of `parse` is `any`

DreierF opened this issue · 2 comments

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

Thanks @DreierF, this is a regression caused by #1310. I'll prioritize a fix later tonight.