Closed
Description
In the following, the type spread is accepted, so the type definitions type checks.
However, there are errors when trying to use fields from x
.
type x = {
x:int
}
type y = {
y: int,
...x,
}
let getY = (v:y) => v.y
// error: This expression has type y The field x does not belong to type y
// let getX = (v:y) => v.x
//error: Some required record fields are missing:
// let v:y = {y:3}
// error: The field x does not belong to type y
// let v:y = {y:3, x:4}