File tree 2 files changed +11
-7
lines changed
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ const React = {
28
28
*/
29
29
export default function domToReact (
30
30
nodes : DOMNode [ ] ,
31
- options ? : HTMLReactParserOptions ,
31
+ options : HTMLReactParserOptions = { } ,
32
32
) : string | JSX . Element | JSX . Element [ ] {
33
33
const reactElements = [ ] ;
34
34
35
- const hasReplace = typeof options ? .replace === 'function' ;
36
- const transform = options ? .transform || returnFirstArg ;
35
+ const hasReplace = typeof options . replace === 'function' ;
36
+ const transform = options . transform || returnFirstArg ;
37
37
const { cloneElement, createElement, isValidElement } =
38
- options ? .library || React ;
38
+ options . library || React ;
39
39
40
40
const nodesLength = nodes . length ;
41
41
@@ -75,7 +75,7 @@ export default function domToReact(
75
75
76
76
// Trim is enabled and we have a whitespace node
77
77
// so skip it
78
- if ( options ? .trim && isWhitespace ) {
78
+ if ( options . trim && isWhitespace ) {
79
79
continue ;
80
80
}
81
81
Original file line number Diff line number Diff line change @@ -10,9 +10,13 @@ export interface HTMLReactParserOptions {
10
10
cloneElement : (
11
11
element : JSX . Element ,
12
12
props ?: object ,
13
- ...children : any
13
+ ...children : any [ ]
14
+ ) => JSX . Element ;
15
+ createElement : (
16
+ type : any ,
17
+ props ?: object ,
18
+ ...children : any [ ]
14
19
) => JSX . Element ;
15
- createElement : ( type : any , props ?: object , ...children : any ) => JSX . Element ;
16
20
isValidElement : ( element : any ) => boolean ;
17
21
[ key : string ] : any ;
18
22
} ;
You can’t perform that action at this time.
0 commit comments