Closed transbitch closed 2 months ago
I'm pretty sure this is a TypeScript-ism that we can't change. It is just how JSX in typescript work. But I'd love to shown otherwise.
I'm pretty sure this is a TypeScript-ism that we can't change. It is just how JSX in typescript work. But I'd love to shown otherwise.
You're totally right, I just looked it up, it's an issue with typescript. React hasn't figured it out either.. Closing as this is blocked by a TS issue open since 2017.
Yeah I think we could benefit from this even more than React given we can have real DOM element types. Anyway, all good. This issue can be a reference for the next person who comes along.
Describe the bug
When a component is created via JSX, it "forgets"/erases the type of the underlying component and assumes that it's simply a
JSX.Element
. This is an incorrect assumption when the type that the function is some intersection, e.g. a component that returnsJSX.Element & FooTy
(see stackblitz).Your Example Website or App
https://stackblitz.com/edit/solidjs-templates-dch5bb?file=src%2FApp.tsx
Steps to Reproduce the Bug or Issue
Expected behavior
<Foo />
should have the same type asFoo()
.Screenshots or Videos
No response
Platform
Additional context
No response