01 / 05
typeof cannot tell them apart
All the narrowing so far had typeof in the lead. Text gave you "string" and a number gave you "number", so that was enough to split them.
But it does nothing for a union of objects. Both of them come back as "object". That will not separate "the dog shape" from "the bird shape".
const dog = { name: "Pochi" };const bird = { flies: true };console.log(typeof dog);console.log(typeof bird);Result
object object