목록intersection (1)
Ted's Codding study
Intersection 타입
1. Intersection 타입이란?여러 타입을 하나로 결합하여 모든 타입의 기능을 갖춘, 단일 타입을 생성하는 방법여러 타입을 모두 만족하는 하나의 타입AND 연산자 (A 그리고 B) - & 기호를 사용하여 구현 2. Intersection 타입 사용type IntersectionType = Type1 & Type2 & Type3;type Employee = { name: string; startDate: Date;};type Manager = { name: string; startDate: Date; group: string; // 부서명};위에 코드에서 name과 startDate가 중복이 됨아래 처럼 Intersection 타입을 활용할 수 있음 type Manager = Employe..
TypeScript
2024. 6. 16. 19:00