Created
October 31, 2022 13:45
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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