`undefined` here is not built-in type or value of the language, it's a standard atom like any other.
So are null, nil, value or false (although false does have a special status in that it's the customary output of boolean operations alongside true).
Can you please explain this further? Why is `None` an inhabitant of this union?
Do you know anything about Erlang? Because unlike typescript, `undefined` in erlang is not a special value, it's just an atom like any other.
> best case scenario is a lot of boilerplate type code.
Do you know anything about Erlang(2)? Because unlike typescript erlang has pattern matching, both faillible and not.
I'm not talking "it can kinda unpack objects", erlang has actual pattern matching (though not unification despite the prolog-inspired syntax), and a simple-looking assignment is a pattern match (and a potential assertion).
Couple things: asking somebody if they know anything about a subject is not a personal attack, and that GP doesn't know anything about Erlang and completely miunderstands the snippet is the strongest plausible interpretation of their comments which assumes good faith.
The alternative interpretations which do not are that they're actively lying, or that they can't be trusted with any device more complicated than a rock or a small stick.
If you know more than someone else, that's great, but please just share some of what you know so the rest of us can learn. Putting others down (even implicitly) doesn't serve learning, it's just distracting and builds up toxins in the ecosystem. Consider how much better your comment would read without those bits. The best way to react to bad information is respectfully with better information.