Skip to content

rescript@11-rc4: gentype output does not respect @tag for tagged variants #6436

Closed
@ybybzj

Description

@ybybzj

in case that:

// Lib.resi
@gentype
@tag("action")
type action =
  | @as("insert") Insert({data: string})
  | @as("retain") Retain({data: string})
  | @as("remove") Remove({data: string})

the generated .ts by gentype are:

// Lib.gen.ts
export type action = 
    { TAG: "insert"; readonly data: string }
  | { TAG: "retain"; readonly data: string }
  | { TAG: "remove"; readonly data: string };

the discriminator property name is still TAG not action

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions