diff --git a/src/core/WidgetBase.ts b/src/core/WidgetBase.ts index c1842adc9..c05c47836 100644 --- a/src/core/WidgetBase.ts +++ b/src/core/WidgetBase.ts @@ -93,7 +93,7 @@ export class WidgetBase

implement * property specifically for typing when using tsx */ /* tslint:disable-next-line:variable-name */ - public __properties__!: this['properties'] & WidgetProperties & { __children__?: DNode[] | DNode }; + public __properties__!: this['properties'] & WidgetProperties & { __children__?: DNode | (DNode | DNode[])[] }; /** * children array diff --git a/src/core/interfaces.d.ts b/src/core/interfaces.d.ts index 3873ef07a..6b2ffd010 100644 --- a/src/core/interfaces.d.ts +++ b/src/core/interfaces.d.ts @@ -576,7 +576,7 @@ export interface WidgetBaseInterface

{ assert.strictEqual(root.innerHTML, 'hello'); }); + it('tsx supports a mixture of array and non array children', () => { + class App extends WidgetBase { + render() { + return

{this.children}
; + } + } + const domNode = document.createElement('div'); + const r = renderer(() => ( + + {[
first
,
second
]} + {
third
} +
+ )); + r.mount({ domNode }); + assert.strictEqual( + domNode.outerHTML, + '
first
second
third
' + ); + }); + describe('supports merging with a widget returned a the top level', () => { it('Supports merging DNodes onto existing HTML', () => { const iframe = document.createElement('iframe'); @@ -3194,7 +3214,7 @@ jsdomDescribe('vdom', () => { }); }); - describe('functional', () => { + describe('function based', () => { it('children', () => { const createWidget = create({ invalidator });