인터페이스
interface A {
a: string;
b: number;
}interface PersonWithReadonly {
readonly name: string;
age?: number;
}
const personReadonly: PersonWithReadonly = {
name: "신봄",
};
person.name = "신봄2"; // 읽기전용 속성이므로 name에 할당할 수 없습니다.interface PersonWithMethod {
readonly name: string;
age?: number;
sayHi: () => void;
// sayHi() : void 로도 할 수 있다.
}
const person: PersonWithMethod = {
name: "신봄",
sayHi: function () {
console.log("Hi");
},
};함수 오버로드 시그니처를 사용할 때
인터페이스 확장
인터페이스 확장 - 타입의 재정의
다중 확장
인터페이스 선언 합치기
주의할 점
모듈 보강시 사용
Last updated