Interface
-
[Typescript] type과 InterfaceFrontend/Typescript 2023. 3. 12. 16:13
TypeScript에서 타입(Type)과 인터페이스(Interface)는 유사한 점이 매우 많고, 여러 경우에 자유롭게 혼용되어 사용 가능합니다. interface AnimalInterface { species: string height: number weight: number } const tiger: AnimalInterface = { species: 'tiger', height: 200, weight: 300 } type AnimalType = { species: string, height: number, weight: number } const lion: AnimalType = { species: 'lion', height: 180, weight: 400 } 하지만 둘의 차이와 한계를 이해하고 표..