|
|
|
|
|
by crooked-v
2314 days ago
|
|
({}).foo returning undefined is exactly what I'd expect. That's a basic part of how accessing properties in Javascript works, and wanting it to work differently is like wanting NullPointerException generation in Java to work differently. > Now imagine hundreds of lines of code and a bunch of asynchronous callbacks occur between the last two lines, and imagine what that does for your debugging experience That's what using typed signatures for your objects is for. It's not even substantially different from having, say, Java with an object with properties that can be nullable or Optional.empty(). |
|
This is an excellent and succinct explanation of why JavaScript is a badly-designed language, and why I use better designed languages when possible.
If the basic properties "work" when it makes no sense for them to work, your language is broken.
> That's what using typed signatures for your objects is for.
Explain more?