@@ -14,7 +14,7 @@ const listenerRegexAt = /^@(.+)$/;
1414export
1515function jsxs (
1616 tagName : string | ( new ( ...args : unknown [ ] ) => Component ) ,
17- attributesWithChildren : { [ attributeName : string ] : unknown , children ?: undefined | string | Component | ComponentChildren } ,
17+ attributesWithChildren : { [ attributeName : string ] : unknown , children ?: undefined | null | string | Component | ComponentChildren } ,
1818 key ?: number
1919) {
2020 let { children, ...attributes } = attributesWithChildren ;
@@ -26,15 +26,17 @@ function jsxs(
2626
2727 if ( Array . isArray ( children ) ) {
2828 childrenArray = children . flat ( ) ;
29- } else if ( children === undefined ) {
29+ } else if ( children === undefined || children === null ) {
3030 childrenArray = [ ] ;
3131 } else if ( typeof children === 'string' ) {
3232 childrenArray = [ new TextComponent ( children ) ] ;
3333 } else {
3434 childrenArray = [ children ] ;
3535 }
3636
37- childrenArray = ( childrenArray ) . map ( child => {
37+ childrenArray = childrenArray
38+ . filter ( child => ! ( child === undefined || child === null ) )
39+ . map ( child => {
3840 if ( typeof child === 'object' && child !== null ) {
3941 if ( Array . isArray ( child ) ) {
4042 throw new Error ( `child is array` ) ;
@@ -87,7 +89,7 @@ function jsxs(
8789export
8890function jsx (
8991 _tagName : string | ( new ( ...args : unknown [ ] ) => Component ) ,
90- _attributesWithChildren : { [ attributeName : string ] : unknown , children ?: undefined | string | Component | ComponentChildren } ,
92+ _attributesWithChildren : { [ attributeName : string ] : unknown , children ?: undefined | null | string | Component | ComponentChildren } ,
9193 _key ?: number
9294) {
9395 return jsxs . apply ( null , arguments as unknown as Parameters < typeof jsx > ) ;
0 commit comments