Closed
Description
thanks to #6391, it's now possible to rename fields of inline records:
type t = Foo({ @as("renamed") name: string, age: int}) | Bar
let foo = Foo({ name: "foo", age: 10 })
generates:
var foo = { TAG: "FOO", renamed: "foo", age: 10 }
But if you try to get the value then it bugs:
let getName = t =>
switch t {
| Bar => "bar"
| Foo({name}) => name
}
generates:
function getName(t) {
if (typeof t !== "object") {
return "bar";
} else {
return t.name; // the error is here, it should be t.renamed
}
}