I found this today while generating ‘.resi’ files to a bunch components. For bindings, I settled with the approach of providing the types props and annotate make like this:
type theme
module Provider: {
type props<'theme, 'children> = {
theme: 'theme,
children: 'children,
}
@module("@mui/material/styles")
external make: React.componentLike<props<theme, React.element>, React.element> = "ThemeProvider"
}
which make the generated JS code use the external directly.
It’s a more time-consuming process, though. So your solution is my first approach and I only use this bindings of 3rd parties components.