|
Thanks! Great suggestions!
Non-nullable types: There's a delicate balance we have to strike where the type system needs to be useful but not too complex. One guiding light for us here has been that toolability is more important than type safety. As non-nullness does little for e.g.
auto-completion and comes with quite a lot of user-facing complexity, we've decided - for now! - not to track it. We note your feedback though; if this becomes a common request we'll take another look at it.
As for the typing of e.g. "null * 7" we can look at that separately from the above question. We do have a null type and could choose to reject this expression. A tradeoff with operators in general is that JavaScript is awash with operator-based idioms that
are concise and useful but inherently "badly" typed. We don't want to police these too strongly so there needs to be some wiggle room. That said, we'll look at this case and see if there's some tightening up we can do without breaking idiomatic scenarios.
Finally, indexers: I am convinced we could have stronger typing here. In particular, since "dotting" in JavaScript is little more than syntactic sugar over indexing with constant strings, the type system could probably do a better job recognizing that
and typingthose two syntaxes in a more similar fashion.
Thanks again for the great feedback!
|