Because a component has this type:
type Component = (props: JsxProps) => Renderable;
type Renderable = JsxNode | NestedArray<JsxNode>;
If we set children as children[0] when children.length is 0, the type of JSX children would be the same as the return type of a component.
Because a component has this type:
If we set
childrenaschildren[0]whenchildren.lengthis 0, the type of JSX children would be the same as the return type of a component.