File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,7 @@ module.exports = {
99 ecmaVersion : 2018 ,
1010 sourceType : "module" ,
1111 } ,
12+ rules : {
13+ '@typescript-eslint/explicit-function-return-type' : 'off'
14+ }
1215} ;
Original file line number Diff line number Diff line change @@ -3,9 +3,12 @@ import * as dom from './dom';
33import { override } from './override' ;
44import { render } from './react' ;
55
6- export function parse ( html : string , userOptions ?: Config ) : React . ReactNode [ ] {
6+ export function parse (
7+ html : React . ReactNode ,
8+ userOptions ?: Config
9+ ) : React . ReactNode [ ] {
710 if ( typeof html !== 'string' ) {
8- throw new TypeError ( 'First argument must be a string.' ) ;
11+ return [ html ] ;
912 }
1013
1114 const options = getConfig ( userOptions ) ;
Original file line number Diff line number Diff line change @@ -9,12 +9,8 @@ describe('Public API', () => {
99 } ) ;
1010
1111 describe ( '#parse' , ( ) => {
12- it ( 'should throw an error if the first parameter is not a string' , done => {
13- try {
14- htmlStringToReact . parse ( null ) ;
15- } catch ( err ) {
16- done ( ) ;
17- }
12+ it ( 'should ignore the input if the format is not supported' , ( ) => {
13+ expect ( htmlStringToReact . parse ( null ) ) . toEqual ( [ null ] ) ;
1814 } ) ;
1915
2016 it ( 'should convert a string to an array of react nodes' , ( ) => {
You can’t perform that action at this time.
0 commit comments