Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript record

interface PageInfo {
  title: string;
}

type Page = "home" | "about" | "contact";

const nav: Record<Page, PageInfo> = {
  about: { title: "about" },
  contact: { title: "contact" },
  home: { title: "home" },
};

nav.about;
//   ^ = Could not get LSP result: v.a>bTry
Source by www.typescriptlang.org #
 
PREVIOUS NEXT
Tagged: #typescript #record
ADD COMMENT
Topic
Name
4+5 =