Skip to content

Instantly share code, notes, and snippets.

@jbmilgrom
Created August 17, 2019 14:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jbmilgrom/2bda2918702a0efb4fdfb06e607d3a63 to your computer and use it in GitHub Desktop.
Example of arbitrary immutable data
enum PrimaryColor {
Red = "RED",
Yellow = "YELLOW",
Blue = "BLUE"
}
const green = [
{ color: PrimaryColor.Yellow, weight: 1 / 2 },
{ color: PrimaryColor.Blue, weight: 1 / 2 }
] as const;
const purple = [
{ color: PrimaryColor.Red, weight: 1 / 2 },
{ color: PrimaryColor.Blue, weight: 1 / 2 }
] as const;
const orange = [
{ color: PrimaryColor.Red, weight: 1 / 2 },
{ color: PrimaryColor.Yellow, weight: 1 / 2 }
] as const;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment