-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @mel.unwrap with uncurry #1027
Comments
In the meantime you can try Js.undefined instead of |
Also note that in rescript 11, we can use @unboxed
type stringOrInt = Str(string) | Int(int)
@module("react-router-dom")
external useNavigate: unit => stringOrInt => unit = "useNavigate"
let navigate = useNavigate()
navigate(Str("/path")) Would supporting |
Thanks, I tried with [@mel.module "react-router-dom"]
external useNavigate:
(Js.undefined(unit), [@mel.unwrap] [ | `Str(string) | `Int(int)]) => unit =
"useNavigate";
let navigate = useNavigate(Js.undefined);
navigate(`Int(-1)); But it stills doesn't compile to what I need: import * as ReactRouterDom from "react-router-dom";
function navigate(param) {
ReactRouterDom.useNavigate(undefined, param.VAL);
}
ReactRouterDom.useNavigate(undefined, -1);
export {
navigate ,
} Is it what you had in mind ? |
This exposes a wider issue that we don't support these attributes inside uncurried externals, e.g.: external x: (. ([@mel.as "hello"] _)) => unit = "asd"; |
fixed in #1140 |
I was trying to create bindings for the following Js code:
I tried the following reason code
But it doesn't compile to what I need (related to #1022)
I thought I would use an uncurried version but it doesn't work with
@mel.unwrap
It gives the following alert:
The uncurried version without
@mel.unwrap
compiles to what I'd need (except that the argument is not unwrapped ofc)Should we support
@mel.unwrap
with uncurry?The text was updated successfully, but these errors were encountered: