Skip to content

Commit 81f74fb

Browse files
feat(index): add htmlparser2 type to HTMLReactParserOptions
1 parent c20f222 commit 81f74fb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

index.d.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// TypeScript Version: 3.3
22

3-
import { DomElement } from 'htmlparser2';
3+
import { DomElement, ParserOptions } from 'htmlparser2';
44
import domToReact from './lib/dom-to-react';
55
import htmlToDOM from 'html-dom-parser';
66

77
export interface HTMLReactParserOptions {
8-
replace?: (
9-
domNode: DomElement
10-
) => JSX.Element | object | void | undefined | null | false;
8+
htmlparser2?: ParserOptions;
9+
1110
library?: {
1211
cloneElement: (
1312
element: JSX.Element,
@@ -18,6 +17,10 @@ export interface HTMLReactParserOptions {
1817
isValidElement: (element: any) => boolean;
1918
[key: string]: any;
2019
};
20+
21+
replace?: (
22+
domNode: DomElement
23+
) => JSX.Element | object | void | undefined | null | false;
2124
}
2225

2326
/**
@@ -32,6 +35,6 @@ declare function HTMLReactParser(
3235
options?: HTMLReactParserOptions
3336
): ReturnType<typeof domToReact>;
3437

35-
export { DomElement, domToReact, htmlToDOM };
38+
export { DomElement, ParserOptions, domToReact, htmlToDOM };
3639

3740
export default HTMLReactParser;

0 commit comments

Comments
 (0)