Skip to content

Instantly share code, notes, and snippets.

@gunzip
Created September 16, 2017 10:05
Show Gist options
  • Save gunzip/936897e963327d18223f64072497db1b to your computer and use it in GitHub Desktop.
Save gunzip/936897e963327d18223f64072497db1b to your computer and use it in GitHub Desktop.
typescript tagged type
declare class As<S extends string> {
private as: S;
}
type Email = string & As<'email'>;
type CustomerId = number & As<'customer-id'>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment