vielen Dank an die Pfeife, die für typeof foo === 'object' für foo === null verantwortlich ist
Die "Pfeife" war Tony Hoare und er hat sich schon dafür entschuldigt:
I call it my billion-dollar mistake. It was the invention of the null reference in 1965.
In TypeScript hat null
übrigens den Typ Null
und man kann strikte Nullchecks aktivieren, um damit auszuschließen, dass man null
anstelle eines Objekts bekommt.