Skip to content

Instantly share code, notes, and snippets.

@wallergoble
Created July 26, 2022 16:50
Show Gist options
  • Save wallergoble/66547c4509d43f4338321cd2359f9324 to your computer and use it in GitHub Desktop.
Save wallergoble/66547c4509d43f4338321cd2359f9324 to your computer and use it in GitHub Desktop.
Typescript template literals
/**
* 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