Closed as not planned
Description
Thanks to the PR #6412, we can rename the returned js object key name. But I found little inconsistent with the exisiting @as
usage on record.
type t0 = {@as("a") type_: string}
@obj
external make: (@as("b") ~type_: string=?) => t0 = ""
let t0 = { type_: "t0"}
let t1 = make(~type_="t1")
let make = make
generated to
var t0 = {
a: "t0"
};
var t1 = {
b: "t1" // shouldn't be a?
};
function make(prim) {
var tmp = {};
if (prim !== undefined) {
tmp.b = prim; // shouldn't be tmp.a = prim?
}
return tmp;
}
IMO, @as("b")
would make rename the argument to b
, but not affecting the returned value that needs to be kept a
by @as("a")
What do you think? @DZakh