Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

How to make .resi files dumped from react files compiler friendly?

$
0
0

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.


Viewing all articles
Browse latest Browse all 2592

Trending Articles