Intersection

TypeScript

interface vs type

interface 문법 interface Square { color :string, width :number, } let 네모 :Square = { color : 'red', width : 100 } type 문법이랑 크게 다를 것은 없다. 차이점을 설명하자면 1. 중복선언이 가능하다 interface Student {name : string} interface Student {score : number} Student라는 인터페이스 안에는 name과 score 변수가 둘 다 존재한다. extends 키워드 사용 전 interface Student { name :string, } interface Teacher { name :string, age :number } 다른 인터페이스이지만 중복되는 변수가 존..