-
Notifications
You must be signed in to change notification settings - Fork 437
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
Uncurried external function with @unwrap polymorphic variant argument does not unwrap in output #5604
Comments
Not likely to be needed now that we're moving towards uncurried only. |
Is it expected that with rescript 11 (uncurried mode by default), the following code @module("react-router-dom")
external useNavigate: unit => @unwrap
[
| #Str(string)
| #Int(int)
] => unit = "useNavigate"
let navigate = useNavigate()
navigate(#Str("path")) Gives |
I would have expected the argument to |
Yeah that does look broken. This would be the preferred way to do that in v11: @unboxed
type stringOrInt = Str(string) | Int(int)
@module("react-router-dom")
external useNavigate: unit => stringOrInt => unit = "useNavigate"
let navigate = useNavigate()
navigate(Str("path")) |
Oh, we can use |
@tatchi yes! 😄 It's quite powerful, and there's a broad range of things you can put in there and still have it be unboxed: https://rescript-lang.org/docs/manual/latest/variant#what-you-can-unbox However, this still seems to be a breakage introduced by v11. We should either fix it (unlikely) or mention it clearly in the migration guide. Thanks for reporting! |
Thank you for filing! Check list:
Using 9.1.3 in the example but also does not compile as expected for 10.0.0-rc.1
example here
The text was updated successfully, but these errors were encountered: