News for hackers. Stuff that matters.
Re:Announcing TypeScript 3.0 by theodorejb on Monday July 30, 2018 @04:12PM (#17647583)
Even if JS engines were to accept the type annotation syntax, there would still be a need to strip out the types simply from the perspective of minimizing JavaScript bundle sizes.
Re:Announcing TypeScript 3.0 by WorldMaker on Monday July 30, 2018 @04:43PM (#17647844)
Most Node code runs unminimized, and HTTP2 makes minimization less of a concern for the web. (It's still useful, of course, but less necessary.)

So sure it is likely that in many cases browsers will still mostly see JS with stripped annotations, but the reason to do it is the same as the debate over whether or not to strip comments and/or support sourcemaps. There's clear wins at the very least in debugging situations to allow unstripped type annotations all the way through to the dev tools. There are even cases where that may make sense even in a production environment, including things like metaprogramming if those annotations are reflectable.

This nice thing would be to have the option, whether or not most projects might still prefer to strip them out to optimize bundle sizes. As with almost all things, it's an interesting spectrum of tradeoffs.

Re:Announcing TypeScript 3.0 by johncolanduoni on Monday July 30, 2018 @10:37PM (#17650111)
How does HTTP2 make minimization less necessary?
Re:Announcing TypeScript 3.0 by bpicolo on Tuesday July 31, 2018 @08:39AM (#17652650)
There have been claims that http2 pipelining means it's more efficient to serve bundles as separate files, unminified so they can be downloaded in parallel. (I haven't yet seen numbers that show it's a benefit in practice though.)
Re:Announcing TypeScript 3.0 by WorldMaker on Tuesday July 31, 2018 @12:05PM (#17654369)
Not just pipelining, but fewer more high-throughput connections, smaller HTTP header overhead, HTTP2 Push with the server being able to stream a "bundle equivalent" to the client in the background, and perhaps most importantly, Brotli compression which does pretty well with unminified JS.
Re:Announcing TypeScript 3.0 by pjmlp on Monday July 30, 2018 @04:46PM (#17647864)
Not necessarily, given that a binary representation is also being discussed (not to mix with WebAssembly).

https://github.com/binast/ecmascript-binary-ast

Re:Announcing TypeScript 3.0 by josteink on Monday July 30, 2018 @05:46PM (#17648380)
> there would still be a need to strip out the types simply from the perspective of minimizing JavaScript bundle sizes.

Are you really sure?

To me that attitude sounds awfully close to cargo-culting.

Re:Announcing TypeScript 3.0 by sbjs on Monday July 30, 2018 @06:10PM (#17648604)
How is that cargo-culting? GP's comment doesn't even seem to come close to the meaning of cargo-culting. And yes, type definitions in my projects account for a good percentage, anywhere from 5-25% of each file, if you take into account all the interfaces, parameter definitions, class types... So that's removing 5-25% of your minified JS bundle, and if we're talking a 4mb bundle, that could be 1mb of type information, completely useless at runtime. If you needed to map that type information to your source code, this is what source maps are for!