Skip to content

Instantly share code, notes, and snippets.

@greggman
Last active March 11, 2024 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greggman/c9ef60a01115ebfdc285aef5d4ed5a92 to your computer and use it in GitHub Desktop.
Save greggman/c9ef60a01115ebfdc285aef5d4ed5a92 to your computer and use it in GitHub Desktop.
Typescript Notes

enum style

export const kEnumByString = ['sameGroup', 'differentGroups'] as const;  // "as const" is important!!!
export type EnumByString = typeof kEnumByString[number];

record style

type Foo = [n: string]: ValueType;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment