Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Enums Christmas edition: support one object type, plus strings/booleans/integers. #118

Merged
merged 8 commits into from
Dec 27, 2018

Conversation

cristianoc
Copy link
Collaborator

…to one object.
Needs some more testing, and checking that the one variant with payload has a payload which as type object, instead of just assuming it.

This:

type payload = {
  x: int,
  y: option(string),
};

type withPayload = [
  | `a
  | [@genType.as "bRenamed"] `b
  | [@genType.as true] `True
  | [@genType.as 20] `Twenty
  | `c(payload)
];

produces:

export type payload = {readonly x: number, readonly y?: string};

export type withPayload = "a" | "bRenamed" | true | 20 | payload;

@cristianoc cristianoc changed the title Enums Christmas edition: support strings, booleans, integers, and up … Enums Christmas edition: support one object type, plus strings/booleans/integers. Dec 27, 2018
@thangngoc89
Copy link
Collaborator

OMG 😮 This is soo cooooool

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants