RecipesChapter 3: The Type System

Enabling Loose Autocomplete for String Subsets

Recipe 3.13 from The TypeScript Cookbook

type ContentType = "post" | "page" | "asset" | string;

function retrieve(content: ContentType): Entry[] {
  // tbd
}
Open in TypeScript Playground →