Skip to content

Instantly share code, notes, and snippets.

@cesalberca
Created September 24, 2020 11:22
Show Gist options
  • Save cesalberca/eb82a6a0a78136f66f82a8f0c437d8bf to your computer and use it in GitHub Desktop.
Save cesalberca/eb82a6a0a78136f66f82a8f0c437d8bf to your computer and use it in GitHub Desktop.
type VerticalAlignment = "top" | "middle" | "bottom";
type HorizontalAlignment = "left" | "center" | "right";
declare function setAlignment(value: `${VerticalAlignment}-${HorizontalAlignment}`): void;
setAlignment("top-left"); // works!
setAlignment("top-middel"); // error!
setAlignment("top-pot"); // error!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment