Skip to content

Issue with record type spread not as first argument. #6293

Closed
@cristianoc

Description

@cristianoc

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions