type Corner = `${'top' | 'bottom'}-${ 'left' | 'right'}`
type VerticalAlignment = "top" | "middle" | "bottom"; type HorizontalAlignment = "left" | "center" | "right"; // Takes // | "top-left" | "top-center" | "top-right" // | "middle-left" | "middle-center" | "middle-right" // | "bottom-left" | "bottom-center" | "bottom-right" declare function setAlignment(value: `${VerticalAlignment}-${HorizontalAlignment}`): void; setAlignment("top-left"); // works! setAlignment("top-middel"); // error! setAlignment("top-pot"); // error! but good doughnuts if you're ever in Seattle
https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types