Unions and Indexing 10 exercises
Problem

Excluding Parts of a Discriminated Union

For this exercise, your job is to extract all of the events from the Event type whose type isn't "keydown":


export type Event =
| {
type: "click"
event: MouseEvent
}
| {
type: "focus"
event: FocusEvent
}
| {
type: "keydown"
event: Keyboar

Loading exercise

Transcript

0:00 In this exercise your job is like the inverse of the previous job where instead of just extracting one event, we now want to extract all of the events that aren't the keydown events. You're going to need another utility type. It's like the reverse of the Extract utility type that we previously looked at.