From 0fd11bc43ccb8448013e7c363e05568af5e27723 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Fri, 19 Aug 2022 09:48:15 +0200 Subject: [PATCH] undo jsx-element removal --- src/index.d.ts | 2 +- src/jsx.d.ts | 1 + test/ts/preact.tsx | 31 ++++++++++++++++--------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index b7f2fb3538..5aee28b2fb 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -87,7 +87,7 @@ export type ComponentProps< : never; export interface FunctionComponent

{ - (props: RenderableProps

, context?: any): ComponentChild; + (props: RenderableProps

, context?: any): VNode; displayName?: string; defaultProps?: Partial

; } diff --git a/src/jsx.d.ts b/src/jsx.d.ts index 325383cbc5..a2908ee7d0 100644 --- a/src/jsx.d.ts +++ b/src/jsx.d.ts @@ -36,6 +36,7 @@ export namespace JSXInternal { : never; }[keyof IntrinsicElements] | ComponentType

; + export interface Element extends VNode {} export type ElementClass = Component | FunctionComponent; export interface ElementAttributesProperty { diff --git a/test/ts/preact.tsx b/test/ts/preact.tsx index 3307fe4d6c..3fbabbfb52 100644 --- a/test/ts/preact.tsx +++ b/test/ts/preact.tsx @@ -102,21 +102,22 @@ const UseOfComponentWithChildren = () => { ); }; -const DummyChildren: FunctionalComponent = ({ children }) => { - return children; -}; - -function ReturnChildren(props: { children: preact.ComponentChildren }) { - return props.children; -} - -function TestUndefinedChildren() { - return ( - - Hello - - ); -} +// TODO: make this work +// const DummyChildren: FunctionalComponent = ({ children }) => { +// return children; +// }; + +// function ReturnChildren(props: { children: preact.ComponentChildren }) { +// return props.children; +// } + +// function TestUndefinedChildren() { +// return ( +// +// Hello +// +// ); +// } // using ref and or jsx class ComponentUsingRef extends Component {