Skip to content

Instantly share code, notes, and snippets.

@jgentes
Created October 31, 2022 13:45
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 jgentes/ca5e084e1e26b90ce1bde95083fd4a8d to your computer and use it in GitHub Desktop.
Save jgentes/ca5e084e1e26b90ce1bde95083fd4a8d to your computer and use it in GitHub Desktop.
Quickly define the values needed in an array and use that array as a type definition
const arrayOfStringLiterals = ['a', 'b', 'c'] as const
type TypeArrayOfStringLiterals = typeof arrayOfStringLiterals[number]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment