Closed
Description
Repro
module type Comp = {
@react.component
let make: () => React.element
}
@react.component
let make = (~comp as module(Comp: Comp)) =>
<Comp />
causes the error:
The module or file Comp can't be found.
This used to work with JSXv3.
ETA:
Actually doesn't need to be used as a component. Simpler repro:
module type T = {
let render: unit => React.element
}
@react.component
let make = (~foo as module(T: T)) => T.render()
Workaround
Destructure the module outside the argument:
@react.component
let make = (~foo) => {
module T = unpack(foo: T)
T.render()
}
or
@react.component
let make = (~foo: module(T)) => {
module T = unpack(foo)
T.render()
}
(unfortunately neither of these work with locally abstract types, see #5978)