type HeroProfile = {
skill: string;
age: number;
}
type HeroNames = 'iron man' | 'hulk' | 'thor'
type Heroes = Record<HeroNames, HeroProfile>;
/** Heroes의 타입
* type Heroes = {
* iron man: HeroProfile;
* hulk: HeroProfile;
* thor: HeroProfile;
* }
*/
type PhoneBook = Record<string, string>; // type Phonebook = { [x: string]: stirng; }
const family: Phone = {
mom: '010-1111-1111',
dad: '010-2222-2222',
bro: '010-3333-3333',
sis: '010-5555-5555'
}
Record<객체 속성의 키로 사용할 타입, 객체 속성의 값으로 사용할 타입>
출처: 쉽게 시작하는 타입스크립트