How can I pass fooB to funA
blog : Enhanced Ergonomics for Record Types | ReScript Blog
playground : ReScript Playground
type a = {
name: string,
age: int,
}
type b<'t> = {
...a,
foo: 't,
}
type c = {
...a,
foo:string,
}
let funA = (foo: a) => {
Console.log(foo)
}
let fooB: b<int> = {
name: "rsb",
age: 12,
foo: 1,
}
let fooC :c = {
name: "rsb",
age: 12,
foo: "c",
}
funA(fooC :> a)
// ERROR: Type b<int> is not a subtype of a
funA(fooB :> a)