객체타입간의 호환성
type Animal = {
name: string;
color: string;
};
type Dog = {
name: string;
color: string;
bread: string;
};
let animal: Anmial = {
name: "기린",
color: "yellow",
};
let dog: Dog = {
name: "돌돌이",
color: "brown",
breed: "진도",
};
animal = dog;
// 타입 에러 발생
dog = animal;
초과 타입 검사
Last updated