Strings In Depth17 / 18
Up next

Template literal types

// a template literal TYPE limits which strings are allowed
type Greeting = `Hello, ${string}!`;
const g: Greeting = "Hello, Ada!";
console.log(g);
What you're solving

constrain a string's shape at the type level