Closed
Description
In DT, preact dependents like preact-i18n have failures in their tests when they should not:
preact-i18n-tests.tsx:26:13 - error TS2786: 'span' cannot be used as a JSX component.
Its type '"span"' is not a valid JSX element type.
26 return <span>{test}</span>;
preact's ElementType looks like this:
export type ElementType<P = any> =
| {
[K in keyof IntrinsicElements]: P extends IntrinsicElements[K]
? K
: never;
}[keyof IntrinsicElements]
| ComponentType<P>;
Replacing P
with any
and deleting the type parameter fixes the problem:
export type ElementType =
| {
[K in keyof IntrinsicElements]: any extends IntrinsicElements[K]
? K
: never;
}[keyof IntrinsicElements]
| ComponentType<any>;
Broken by #51328. Looks like almost the right test case was added to catch this, but not quite.