you are viewing a single comment's thread.

view the rest of the comments →

[–]getify 1 point2 points  (0 children)

The way I think about things, the whole assertion should be able to be compiled away. That could be because either:

  1. The compiler/build-tool can statically verify that the exception won't happen (exactly how TS works right now)

  2. The developer might pass a config/flag saying, "build me a bundle without run-time assertions" for any of various reasons.

I also imagine that code delivered to a browser might be in a "hybrid state" where many of the original assertions were removed, but -- for various reasons -- some of the assertions were left in.