[[Discriminated Union]]도 결국 object들의 union으로 구성되어있기 때문에 [[Union]]에 구분자를 index로 넣으면 구분자들의 값을 얻을 수 있다.
```typescript
export type Event =
| {
type: "click";
event: MouseEvent;
}
| {
type: "focus";
event: FocusEvent;
}
| {
type: "keydown";
event: KeyboardEvent;
};
type EventType = Event["type"];
//expected: "click" | "focus" | "keydown"
```
위 예제의 경우 구분자는 `type`이고 `Event`에서 `"type"`으로 indexing 하면 값들을 뽑아낼 수 있다.
---
참조 강의: https://inf.run/FVDi