Skip to content

undo jsx-element removal#3680

Merged
marvinhagemeister merged 1 commit intomasterfrom
fix-jsx-element
Aug 19, 2022
Merged

undo jsx-element removal#3680
marvinhagemeister merged 1 commit intomasterfrom
fix-jsx-element

Conversation

@JoviDeCroock
Copy link
Copy Markdown
Member

Resolves #3679
Re-opens #3611

While working on this I did not realise that we have an override in our tests to make JSX.Element work https://github.com/preactjs/preact/blob/master/test/ts/jsx-namespacce-test.tsx#L7 which lead me to believe that TS constructs its own given the ElementType you export. This was wrong, this re-introduces the bug of children which is a more subtile issue with how we typed FunctionComponent and ClassComponent

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 99.291% when pulling 0fd11bc on fix-jsx-element into b7072ad on master.

@marvinhagemeister marvinhagemeister merged commit 5362360 into master Aug 19, 2022
@marvinhagemeister marvinhagemeister deleted the fix-jsx-element branch August 19, 2022 08:40

export interface FunctionComponent<P = {}> {
(props: RenderableProps<P>, context?: any): ComponentChild;
(props: RenderableProps<P>, context?: any): VNode<any>;
Copy link
Copy Markdown
Contributor

@piotr-cz piotr-cz Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't revert return type to VNode<any> | null, as it was in v10.10.3

Returning null from components is valid, as described here:
React Docs > Preventing Component from Rendering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type for Element changed to ElementType: intended?

4 participants