News for hackers. Stuff that matters.
Re:Bad TypeScript Habits by chrismorgan on Wednesday February 03, 2021 @02:07AM (#26011327)
I don’t know. I would guess that that return type involved a slightly heated discussion before undefined won over null so that you can distinguish it returning an element that is null.

(This is a fundamental problem of nullable types which is solved by algebraic data types; in Rust, the equivalent method would return None for “no value found”, or Some(None) if it found a None value.)

There are no comments on this comment yet.