Of Pizza Types Primitives And Objects, and the practical examples still hold up.
The pizza analogy is cute, but I always wish these intros hit the one thing people actually trip on: typeof null being "object". That’s the part that gets me, because it quietly breaks the “just use typeof” advice and pushes you toward explicit value === null checks.
typeof null === "object" is the OG footgun, but in UI land typeof [] === "object" is the one that keeps making “just use typeof” feel like a lie. Once you’re already doing Array. isArray() and v === null checks, typeof is basically just a quick “is this a function” filter. I usually keep it boring and do v == null when I mean “null or undefined, ” and save the explicit === null for the rare times I actually care which one it is.
okay so typeof x === "function" is basically the only typeof check in UI code that still feels honest to me — it’s saved me from the “someone passed true as a handler” thing more times than I want to admit.
for arrays/objects, yeah, typeof is just noise. once you’re already doing Array.isArray(v) and v == null guards, you’re basically in “validate the signal chain” mode anyway: check the couple properties you actually need and move on. i’ve stopped linking deep-dive articles for this one because it always turns into “here’s why JS is weird” and not “here’s how to not crash your render.”
That is wild