File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ const React = {
2828 */
2929export default function domToReact (
3030 nodes : DOMNode [ ] ,
31- options ? : HTMLReactParserOptions ,
31+ options : HTMLReactParserOptions = { } ,
3232) : string | JSX . Element | JSX . Element [ ] {
3333 const reactElements = [ ] ;
3434
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 ;
3737 const { cloneElement, createElement, isValidElement } =
38- options ? .library || React ;
38+ options . library || React ;
3939
4040 const nodesLength = nodes . length ;
4141
@@ -75,7 +75,7 @@ export default function domToReact(
7575
7676 // Trim is enabled and we have a whitespace node
7777 // so skip it
78- if ( options ? .trim && isWhitespace ) {
78+ if ( options . trim && isWhitespace ) {
7979 continue ;
8080 }
8181
Original file line number Diff line number Diff line change @@ -10,9 +10,13 @@ export interface HTMLReactParserOptions {
1010 cloneElement : (
1111 element : JSX . Element ,
1212 props ?: object ,
13- ...children : any
13+ ...children : any [ ]
14+ ) => JSX . Element ;
15+ createElement : (
16+ type : any ,
17+ props ?: object ,
18+ ...children : any [ ]
1419 ) => JSX . Element ;
15- createElement : ( type : any , props ?: object , ...children : any ) => JSX . Element ;
1620 isValidElement : ( element : any ) => boolean ;
1721 [ key : string ] : any ;
1822 } ;
You can’t perform that action at this time.
0 commit comments