-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
The new typings introduced in #1116 broke custom elements for me. Is there a workaround, am I using JSX.IntrinsicElements wrong or do we need a fix for preact’s typings?
Test case (attach this to test/ts/VNode-test.s):
class TestCE extends HTMLElement {}
declare global {
namespace JSX {
interface IntrinsicElements {
["test-ce"]: Partial<TestCE>;
}
}
}
const MyTestCustomElement = <test-ce><div>hai</div></test-ce>;Error:
test/ts/VNode-test.tsx:78:30 - error TS2322: Type '{ children: Element; }' is not assignable to type 'Partial<TestCE>'.
Types of property 'children' are incompatible.
Type 'Element' is not assignable to type 'HTMLCollection | undefined'.
Type 'Element' is not assignable to type 'HTMLCollection'.
Property 'namedItem' is missing in type 'Element'.
const MyTestCustomElement = <test-ce><div>hai</div></test-ce>;