We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
ReScript version: v12.0.0-alpha.13
v12.0.0-alpha.13
The following code (playground link)
type actionType1 = | WithoutPayload1 | WithPayload1({x: int}) type actionType2 = | WithoutPayload2 | WithPayload2({y: int}) | WithPayload3({y: int}) type actionType3 = | WithPayload4({x: int}) | WithPayload5({y: int}) | WithPayload6({x: int}) | WithPayload7({y: int}) | WithPayload8({x: int}) type action = | ...actionType1 | ...actionType2 | ...actionType3 let f = (action: action) => { switch action { | ...actionType3 => Console.log("hello") | _ => () } 42 }
sometimes gets compiled to
function f(action) { if (typeof action !== "object") { action === "WithoutPayload1"; } else { switch (action.TAG) { case "WithPayload1" : case "WithPayload2" : case "WithPayload3" : break; default: console.log("hello"); } } return 42; }
I say 'sometimes' as by rerunning the compiler you can get the correct output of
function f(action) { if (typeof action === "object") { switch (action.TAG) { case "WithPayload4" : case "WithPayload5" : case "WithPayload6" : case "WithPayload7" : case "WithPayload8" : console.log("hello"); break; } } return 42; }
See this video:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ReScript version:
v12.0.0-alpha.13
The following code (playground link)
sometimes gets compiled to
I say 'sometimes' as by rerunning the compiler you can get the correct output of
See this video:
Kooha-2025-05-12-19-47-57.webm
The text was updated successfully, but these errors were encountered: