Skip to content

Commit f1fc00b

Browse files
fix: refactor TypeScript declaration file for index.d.ts
The script `npm run dtslint` was returning the error: ``` ERROR: 5:1 expect TypeScript@next expected type to be: string | DetailedReactHTMLElement<{}, HTMLElement> | DetailedReactHTMLElement<{}, HTMLElement>[] got: string | ReactElement | ReactElement[] ```
1 parent b49ee28 commit f1fc00b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import { DomElement } from 'domhandler';
55
import domToReact from './lib/dom-to-react';
66
import htmlToDOM from 'html-dom-parser';
77

8-
export { DomElement };
9-
10-
type ReactElement = React.DetailedReactHTMLElement<{}, HTMLElement>;
11-
128
export interface HTMLReactParserOptions {
139
// TODO: Replace `object` by type for objects like `{ type: 'h1', props: { children: 'Heading' } }`
1410
replace(domNode: DomElement): React.ReactElement | object | undefined | false;
@@ -24,7 +20,11 @@ export interface HTMLReactParserOptions {
2420
declare function HTMLReactParser(
2521
html: string,
2622
options?: HTMLReactParserOptions
27-
): ReactElement | ReactElement[] | string;
23+
):
24+
| string
25+
| React.DetailedReactHTMLElement<{}, HTMLElement>
26+
| Array<React.DetailedReactHTMLElement<{}, HTMLElement>>;
27+
28+
export { DomElement, domToReact, htmlToDOM };
2829

29-
export { domToReact, htmlToDOM };
3030
export default HTMLReactParser;

0 commit comments

Comments
 (0)