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

type of htm/preact and htm directly are different #244

Open
Haroenv opened this issue Apr 7, 2023 · 1 comment
Open

type of htm/preact and htm directly are different #244

Haroenv opened this issue Apr 7, 2023 · 1 comment

Comments

@Haroenv
Copy link

Haroenv commented Apr 7, 2023

declare const html: (strings: TemplateStringsArray, ...values: any[]) => VNode;

this returns VNode, while if you do htm.bind(h) the inferred return type is VNode | VNode[]

htm/src/index.d.ts

Lines 2 to 4 in d62dcfd

bind<HResult>(
h: (type: any, props: Record<string, any>, ...children: any[]) => HResult
): (strings: TemplateStringsArray, ...values: any[]) => HResult | HResult[];

Which one of the two types is correct? Should this be changed in the htm/preact type?

@Haroenv
Copy link
Author

Haroenv commented Apr 7, 2023

The React typings also don't allow the array form:

declare const html: (strings: TemplateStringsArray, ...values: any[]) => React.ReactElement;

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

No branches or pull requests

1 participant