GirişTanımı
şöyle. K olarak verilen tipini - örneğin bir enum olsun - tüm değerlerinin kullanılmasını mecburi yapar.
type Record<K extends string, T> = {
[P in K]: T;
}
Örnek
const SERVICES: Record<string, string> = {
doorToDoor: "delivery at door",
airDelivery: "flying in",
specialDelivery: "special delivery",
inStore: "in-store pickup",
};
Örnek
type CatNames = "miffy" | "boris" | "mordred";
type CatList = Record<CatNames, {age: number}>
const cats:CatList = {
miffy: { age:99 },
boris: { age:16 },
mordred: { age:600 }
}