[TypeScript] 타입스크립트 Type과 Interface 차이점


[TypeScript] 타입스크립트 Type과 Interface 차이점

인터페이스 Interface 인터페이스(Interface) interface PeopleInterface { name: string age: number } const me1: PeopleInterface = { name: 'yc', age: 34, } 인터페이스 확장시 interface PeopleInterface { name: string age: number } interface StudentInterface extends PeopleInterface { school: string } 인터페이스 선언적 확장 같은 이름으로 인터페이스를 만든다면 자동으로 확장된다. 선언적 확장에 대해서는 타입(Type)은 불가능 하고 인터페이스는 가능하다. 그 예제는 아래와 같다. interface Window { title: string } interface Window { ts: TypeScriptAPI } 인터페이스는 객체에만 사용이 가능 interface FooInterface { valu...


#generic #interface #type #typescript #인터페이스 #제너릭 #제네릭 #타입 #타입스크립트

원문링크 : [TypeScript] 타입스크립트 Type과 Interface 차이점