You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[x ] Check if updating to the latest Preact version resolves the issue
Describe the bug
When using htm with typescript I have types incompatibility
import {FunctionalComponent, h} from 'preact'
import htm from 'htm'
const html = htm.bind(h)
const TestComponent: FunctionalComponent<{ foo: number }> = ({ foo }) => {
return html`<div>${foo}</div>`
}
Here typescript complains that
TS2322: Type '({ foo }: RenderableProps<{ foo: number; }, any>) => VNode<any> | VNode<any>[]' is not assignable to type 'FunctionalComponent<{ foo: number; }>'. Type 'VNode<any> | VNode<any>[]' is not assignable to type 'VNode<any> | null'. Type 'VNode<any>[]' is missing the following properties from type 'VNode<any>': type, props, key
Expected behavior
No type error.
Doing
return html`<div>${foo}</div>` as VNode<any>
resolves this issue but I think it will be better to change htm or FunctionalComponent declaration.
The text was updated successfully, but these errors were encountered:
Describe the bug
When using htm with typescript I have types incompatibility
Here typescript complains that
TS2322: Type '({ foo }: RenderableProps<{ foo: number; }, any>) => VNode<any> | VNode<any>[]' is not assignable to type 'FunctionalComponent<{ foo: number; }>'. Type 'VNode<any> | VNode<any>[]' is not assignable to type 'VNode<any> | null'. Type 'VNode<any>[]' is missing the following properties from type 'VNode<any>': type, props, key
Expected behavior
No type error.
Doing
resolves this issue but I think it will be better to change htm or FunctionalComponent declaration.
The text was updated successfully, but these errors were encountered: