A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-160.ts
1classA{}
2classBextendsA{}
3constx=newB()
4console.log(xinstanceofA&&xinstanceofB)
Narrowing
Answer & explanation
Console output
true
Why
A `B` instance has both `B.prototype` and its parent `A.prototype` in its chain, so it is simultaneously an instance of B and of A. Both `instanceof` checks pass and the conjunction is true. TypeScript narrows `x` to the most specific matching type, here `B`.