You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change is unfortunately necessary until either
microsoft/TypeScript#61620 (a new issue
reported by me) or microsoft/TypeScript#21699
(a longstanding old issue unlikely to be fixed) are resolved.
TypeScript uses the JSX.Element type to determine the type of any
JSX expression. It is not possible for two different JSX expressions to
evaluate to different types.
Gooey supports asynchronous components, **but** in order for this to
work a component must be defined as something that returns a
JSX.Element; so JSX.Element must be extended to become:
RenderNode | (Promise<RenderNode> & Partial<RenderNode>)
This extension of (Promise<RenderNode> & Partial<RenderNode>) means that
in practice, users can easily call rendernode methods (like `.retain()`) via:
const jsx = <div />;
jsx.retain?.();
// ...
jsx.release?.();
Which should always work, as the `createElement` jsxFactory function
always returns a `RenderNode`.
It's really unfortunate that the optional chaining operation is needed
here.
Hopefully when either of those issues are fixed, the JSX evaluation type
can be separated from the function component return type.
0 commit comments