I mentioned this quite a few times already, I think we should absolutely make Jsx.component abstract.
Reasons:
First, the existing type definition as
type component<'props> = 'props => Jsx.element
is simply wrong. There are a lot of React components that do not have this shape, like class components, fragments, memoized components, etc., etc.
Second, the existing definition leads to weird errors / weird workarounds when writing bindings. Even though Jsx.component<'props> is defined as 'props => Jsx.element, the two are not equivalent when writing bindings.
You need to use Jsx.component<'props> (or @jsx.component, but that's not always what you want) and not props => Jsx.element. Otherwise you end up with things like <prim => SomeLib.Head(prim)> instead of <Head> in the JS output (latest instance of this problem in #8047).
I mentioned this quite a few times already, I think we should absolutely make
Jsx.componentabstract.Reasons:
First, the existing type definition as
is simply wrong. There are a lot of React components that do not have this shape, like class components, fragments, memoized components, etc., etc.
Second, the existing definition leads to weird errors / weird workarounds when writing bindings. Even though
Jsx.component<'props>is defined as'props => Jsx.element, the two are not equivalent when writing bindings.You need to use
Jsx.component<'props>(or@jsx.component, but that's not always what you want) and notprops => Jsx.element. Otherwise you end up with things like<prim => SomeLib.Head(prim)>instead of<Head>in the JS output (latest instance of this problem in #8047).