TypeScript : 연산자 타입 (유니언 타입, 인터섹션 타입)
Union Type
Union Type은 JavaScript에서 AND 연산자와 OR 연산자를 생각하면 이해하기 쉽습니다.
1 | function logText(text: string | number) { |
1 | function getBirth(birth: number | string) { |
Intersection Type
1 | interface Person { |
Union Type은 JavaScript에서 AND 연산자와 OR 연산자를 생각하면 이해하기 쉽습니다.
1 | function logText(text: string | number) { |
1 | function getBirth(birth: number | string) { |
1 | interface Person { |