&
-
type vs interfaceComputer Science/TypeScript 2023. 9. 22. 22:57
https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces Documentation - Everyday Types The language primitives. www.typescriptlang.org TypeScript 공식 사이트에서 간략하게 차이를 설명하고 있다. 1. 선언 Interface 와 type 모두 타입을 정의하는 주요 방법이지만, 선언 방식과 정의 할 수 있는 경우의 차이가 존재한다. 둘다 객체와 함수를 정의할 수 있지만 string, number, union, tuple 등 기본 타입은 type 에서만 선언 할 수 있으며 interface에서..