[[instanceof演算子]]を使った[[Narrowing]]。 ```ts class Human { constructor(public id: number, public name: string) { } } class Animal { constructor(public name: string) { } } declare const anonymous: Human | Animal if (anonymous instanceof Human) { anonymous //^? const anonymous: Human } else { anonymous //^? const anonymous: Animal } ``` <button class="playground"><a href="https://www.typescriptlang.org/play?#code/MYGwhgzhAEASCuBbMA7aBvAUNawD2KEALgE7zBF4kAUADvAEYgCWw0zAJgFzQpIMBTEgBpo9Jq15hEAnsRLMUAcwCUGaAF9MWzKEgwAgimbIQGbLgLzylGuJZsU02dHmLV6rTo4C9JAZaERNCoBACeiHjwEDwIyGgAPtBGJmAgmMwAZtDUoSgRUTCKxKjAAnjZcahqWDh5BdEWAPRNAHoA-NrQAiAQAbUhKOGRjTgtHdpAA">Playground</a></button>