Created
July 26, 2022 16:50
-
-
Save wallergoble/66547c4509d43f4338321cd2359f9324 to your computer and use it in GitHub Desktop.
Typescript template literals
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
/** | |
* String template literal types | |
*/ | |
type FlagColor = "red" | "green" | "yellow"; | |
type LightFlagColor = `light${FlagColor}`; | |
let lightRed: LightFlagColor = "lightred"; | |
// https://github.com/sindresorhus/type-fest/blob/main/source/camel-case.d.ts | |
// https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment