"타입-레벨 ternary. Compiler 가 값 계산하듯 타입 계산."
모양
Conditional 타입이 T extends X ? A : B 형태. 타입 레벨에서 평가: T 가 X 에 assignable 하면 타입 A; 아니면 B. 여기 `extends` 가 generic constraint 에 쓰이는 같은 구조-assignability 체크.
Conditional 타입이 standard library 가 computed 타입 표현하는 법 — `ReturnType`, `Parameters`, `Awaited`, `NonNullable` 다 내부적으로 conditional 타입. 읽을 수 있게 되면 TypeScript 의 대부분 고급 타입 library 읽을 수 있어.
Distribution 규칙 (미리보기)
체크된 타입 (T) 이 naked generic parameter 일 때, conditional 타입이 union 에 분배. `string | number` 에 적용된 type Wrap<T> = T extends unknown ? { value: T } : never 가 분배: Wrap<string> | Wrap<number> = { value: string } | { value: number }. 트랙 6 에서 다뤘어; 같은 규칙 적용.
Bracket 트릭 ([T] extends [X]) 이 필요할 때 distribution 비활성화. Union 이 나뉘지 말아야 할 yes/no 체크에 사용.
Conditional composing
Conditional 체인 가능: type Classify<T> = T extends string ? 'str' : T extends number ? 'num' : 'other'. Multi-arm switch 처럼 읽어 — 각 `: T extends ...` 가 다음 case.