Closed
Description
After #6874, I have the following problem:
module FormattedMessage = {
@react.component @module("react-intl")
external make: (~id: string, ~defaultMessage: string) => React.element = "FormattedMessage"
}
let _ = <FormattedMessage id="test" defaultMessage="Test" />
compiles to
JsxRuntime.jsx((function (prim) {
return ReactIntl.FormattedMessage;
}), {
id: "test",
defaultMessage: "Test"
});
(which fails at runtime) instead of
JsxRuntime.jsx(ReactIntl.FormattedMessage, {
id: "test",
defaultMessage: "Test"
});
I think the root cause is that React.component
is not defined as an abstract type, but as 'props => React.element
. @mununki tried to make it abstract in #6304, but hit a roadblock.
Although I am also asking myself why the compiler needs to introduce that extra function now that it knows that the external is a function of arity 1.
Metadata
Metadata
Assignees
Labels
No labels