rescript-lang/rescript-react

Wrap existing React component library in JS with invalid prop names

l2dy opened this issue · 1 comments

l2dy commented

I have a React component <Switch type="switch | checkbox" /> from a JS library, can I import it to ReScript and make it take an argument of ~type_: [#switch_ | #checkbox]?

I have tried the @as annotation in arguments of the external make function, but it doesn't work well with @react.component. @string [@as("switch") #switch_ | #checkbox] works, but @as("type") ~type_: still compiles to type_ where <Switch /> is used.

l2dy commented

Sorry, should have posted this in the forum.