// Error: Property 'pages' does not exist on type 'Poem'.// Error: Property 'pages' does not exist on type 'Poem'.
// Property 'pages' does not exist on type 'PoemWithRhymes'.// Property 'pages' does not exist on type 'PoemWithRhymes'.
판별된 유니언은 우아한 자바스크립트 패턴과 타입스크립트의 타입 내로잉을 아름답게 결합하
므로 타입스크립트에서 필자가 가장 좋아하는 기능입니다.
10
장 ‘제네릭’과 관련된 프로젝트에
서 제네릭
generic
데이터 운영을 위해 판별된 유니언을 사용하는 방법을 자세히 살펴봅니다.
4.4
교차 타입 교차 타입
타입스크립트 유니언 타입은 둘 이상의 다른 타입 중 하나의 타입이 될 수 있음을 나타냅니다.
자바스크립트의 런타임
|
연산자가
&
연산자에 대응하는 역할을 하는 것처럼, 타입스크립트에
서도
&&
교차 타입교차 타입
intersection ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.