title | references |
---|---|
TypeScript Lookup Types |
type Post = {
title: string
publishDate: Date
tags: string[]
}
let tags = ["Barbie", "Ken", "Alan"]: Post["tags"];
let tag = "test": Post["tags"][0];
tags; // string[]
tag; // string
title | references |
---|---|
TypeScript Lookup Types |
type Post = {
title: string
publishDate: Date
tags: string[]
}
let tags = ["Barbie", "Ken", "Alan"]: Post["tags"];
let tag = "test": Post["tags"][0];
tags; // string[]
tag; // string