Created
January 15, 2022 04:45
-
-
Save obaranovskyi/9d4ea2d9058fa0d5f1d9dab5e0b92d97 to your computer and use it in GitHub Desktop.
This file contains 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 roles = ['read', 'write', 'readAndWrite'] as const; | |
type Roles = typeof roles[number]; | |
// equals to this | |
// type Roles = "read" | "write" | "readAndWrite" | |
// or even like this | |
type RolesInCapital = Capitalize<typeof roles[number]>; | |
// equals to this | |
// type RolesInCapital = "Read" | "Write" | "ReadAndWrite" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't ts