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

TS: jsx factory return type doesn't match VNode #4154

Closed
1 task done
marvinhagemeister opened this issue Oct 6, 2023 · 1 comment · Fixed by #4158
Closed
1 task done

TS: jsx factory return type doesn't match VNode #4154

marvinhagemeister opened this issue Oct 6, 2023 · 1 comment · Fixed by #4158
Labels

Comments

@marvinhagemeister
Copy link
Member

  • Check if updating to the latest Preact version resolves the issue

Describe the bug
Noticed that the return type of h/createElement doesn't match VNode anymore.

To Reproduce

This snippet throws a type error:

import { type VNode, h } from "preact";

const arr: VNode[] = []
arr.push(h("div", null))

Expected behavior
No type errors

@JoviDeCroock
Copy link
Member

JoviDeCroock commented Oct 12, 2023

They do seem to be returning a valid VNode, I wonder how they diverge https://github.com/preactjs/preact/blob/main/src/index.d.ts#L190-L236

also does not error for me here https://stackblitz.com/edit/typescript-cgdesq?file=index.ts,package.json

EDIT had to enable strict mode it's something with null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants