명시 속성도 검사
[key: string]: string이면 id: number는
같은 객체 안에 둘 수 없습니다.
index signature
동적 키를 허용하면 명시 속성, 숫자 키, 읽기 결과가 모두 같은 값 타입 규칙 안에 들어옵니다.
[key: string]: string이면 id: number는
같은 객체 안에 둘 수 없습니다.
자바스크립트 런타임에서는 obj[0]과
obj["0"] 접근이 연결됩니다.
알려진 키 집합이면 열린 시그니처보다 Record나
keyof가 더 선명합니다.
interface Profile {
id: number;
[key: string]: string;
}
interface Profile {
id: number;
name: string;
[key: string]: string | number;
}