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
I am trying to use Preact with TypeScript but without JSX. However, without JSX any regular components (div/input/etc) apparently are typed as generic components.
Expected Behavior
// Assuming this line typechecksconstdoesWork=<inputonInput={onInput}/>;// I would expect the following line to be equivalentconstdoesNotWork=h("input",{onInput: onInput});
Actual Behavior
The second line (without JSX) complains that
No overload matches this call.
Overload 1 of 2, '(type: string, props: HTMLAttributes<EventTarget> & SVGAttributes<SVGElement> & Record<string, any>, ...children: ComponentChildren[]): VNode<...>', gave the following error.
Type '({ currentTarget }: TargetedEvent<HTMLInputElement, Event>) => void' is not assignable to type 'GenericEventHandler<EventTarget> & GenericEventHandler<SVGElement>'.
Type '({ currentTarget }: TargetedEvent<HTMLInputElement, Event>) => void' is not assignable to type 'GenericEventHandler<SVGElement>'.
Types of parameters '__0' and 'event' are incompatible.
Type 'TargetedEvent<SVGElement, Event>' is not assignable to type 'TargetedEvent<HTMLInputElement, Event>'.
Type 'TargetedEvent<SVGElement, Event>' is not assignable to type '{ readonly currentTarget: HTMLInputElement; }'.
Types of property 'currentTarget' are incompatible.
Type 'SVGElement' is missing the following properties from type 'HTMLInputElement': accept, align, alt, autocomplete, and 69 more.
Overload 2 of 2, '(type: ComponentType<{ onInput: ({ currentTarget }: TargetedEvent<HTMLInputElement, Event>) => void; }>, props: Attributes & { ...; }, ...children: ComponentChildren[]): VNode<...>', gave the following error.
Argument of type '"input"' is not assignable to parameter of type 'ComponentType<{ onInput: ({ currentTarget }: TargetedEvent<HTMLInputElement, Event>) => void; }>'.ts(2769)
The text was updated successfully, but these errors were encountered:
Reproduction
https://codesandbox.io/s/throbbing-wildflower-jr1t4?file=/index.tsx
Steps to reproduce
I am trying to use Preact with TypeScript but without JSX. However, without JSX any regular components (div/input/etc) apparently are typed as generic components.
Expected Behavior
Actual Behavior
The second line (without JSX) complains that
The text was updated successfully, but these errors were encountered: