Loading problem…
Predict whether this compiles and why.
type Cat = { kind: 'cat'; meow: () => void } type Dog = { kind: 'dog'; bark: () => void } function speak(pet: Cat | Dog) { if ('meow' in pet) { pet.meow() } else { pet.bark() } }