3 ms·
> Closure Compiler types are/were too verbose. The difference is about the length of an additional "/ @type /" and the fact that the annotation is in a comment
by magicalist 10y ago
> Closure Compiler types are/were too verbose.
The difference is about the length of an additional "/ @type /" and the fact that the annotation is in a comment, not in code. That had the benefit that that all code for closure was valid JavaScript, which was key in the days before basically all production JavaScript went through a transpilation step.
> It didn't support most module systems until this year.*
ES6 modules maybe, but it's supported CommonJS and AMD modules since 2011[1] and its own module format before that.
The real reasons I think it didn't catch on are that it came out too early for much of the JS world, the closure library is written verbosely/awkwardly (though there's no reason to touch it when using the compiler, they're associated by name), and many thought you to annotate all existing code to use it instead of adding annotations incrementally.
[1] http://www.nonblocking.io/2011/12/experimental-support-for-common-js-and.html http://www.nonblocking.io/2011/12/experimental-support-for-c...
- spion 10y ago1. Its unclear how you can declare new generic types using @type Here is an example type of a map function in TypeScript: declare var map: <T, U>(f: (t:T) => U, t:T[]) => U[] I cannot figure out the equivalent @type annotation in Closure using these docs: https://developers.google.com/closure/compiler/docs/js-for-compiler#declaring-a-generic-type https://developers.google.com/closure/compiler/docs/js-for-c...