목록typescript (1)
현인
[TypeScript] interface와 type의 차이점
프로젝트를 하던 중 TypeScript의 type과 interface의 차이점이 궁금하여 알아보았다 interface는 type과 마찬가지로 객체의 타입의 이름을 지정하는 또 다른 방법이다. 확장하는 방법의 차이 interface Person { name : string, age : number } interface Student extends Person{ school : string } extends 방식 type Person = { name : string, age : number } type Student = Person & { school : string } & 활용 선언적 확장 type은 새로운 속성을 추가하기 위해서 다시 같은 이름으로 선언할 수 없지만, interface는 항상 선언적 확장..
기술 학습
2023. 3. 15. 16:32