Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undo jsx-element removal #3680

Merged
merged 1 commit into from
Aug 19, 2022
Merged

undo jsx-element removal #3680

merged 1 commit into from
Aug 19, 2022

Conversation

JoviDeCroock
Copy link
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

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
@@ -87,7 +87,7 @@ export type ComponentProps<
: never;

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

@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