1interface Tarea {
2 titulo: string;
3 descripcion: string;
4 completado: boolean;
5}
6
7type TareaReducido = Pick<Tarea, "titulo" | "descripcion">;
8
9const tarea: TareaReducido = {
10 titulo: "Limpiar Recamara",
11 descripcion: "Poner en orden todo lo que existe en la recamara",
12};
13
1interface Person {
2 name: string;
3 age: number;
4 location: string;
5}
6
7type K1 = keyof Person; // "name" | "age" | "location"
8type K2 = keyof Person[]; // "length" | "push" | "pop" | "concat" | ...
9type K3 = keyof { [x: string]: Person }; // string
1interface PageInfo {
2 title: string;
3}
4
5type Page = "home" | "about" | "contact";
6
7const nav: Record<Page, PageInfo> = {
8 about: { title: "about" },
9 contact: { title: "contact" },
10 home: { title: "home" },
11};
12
13nav.about;
14// ^ = Could not get LSP result: v.a>bTry