Recs.
Updated
TypeScript is a language for application-scale JavaScript development.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
SpecsUpdate
Pros
Pro Built and supported by Microsoft
Being built by Microsoft, TypeScript is much more likely than most other similar open-source projects to receive continued long-term support, good documentation, and a steady stream of development.
Cons
Con Too similar to Javascript
Presents some advantages compared to Javascript, but because it is designed to be a superset of Javascript, it means all the bad parts of Javascript are still present.
Con Type inference coverage is incomplete
The default type when declaring and using a variable is any
. For example, the following should break but does not:
function add(a:number) { return a + 1 }
function addAB(a, b) {return add(a) + b}
addAB("this should break but doesn't :(", 100)
In order to avoid this, you have to declare type signatures for every variable or parameter or set the flag --noImplicityAny
when running the compiler.
Con Requires "this" for field access
Even in cases were there is no ambiguity, you still have to use "this.fieldName" instead of just "fieldName".
Con No support for conditional compilation
There is no clean way to have debug and release builds compiled from the same source, where the release version removes all debugging tools and outputs from the generated file(s).
Con Awful error messages
Comparing to Elm or Rust for example, TypeScript's error messages won't say you very much. For example if you change method of interface which your class implements it won't say your class have incorrect implementation. Instead it'll show error in usage of instances of class. In some cases it can spoil hours of your work trying to figure out why your parameters are incorrect.
Con Far less typed libraries than Dart (and TSD are never up to date)
Recommendations
Comments
Flagged Pros + Cons
Con Inherits all the flaws of JavaScript
Unstable dependency management. Inconsistent core APIs. Fragmented async landscape (Promises/callbacks) – at least before async/await gets added.
Con Benefits don't exceed costs
It is rather unnecessarily complicated for experienced JavaScript developers.
Out of Date Pros + Cons
Con Unversioned community type definitions
It can be difficult to find type annotations for older versions of different libraries because community type definitions are not versioned. (No longer true as of TypeScript 2)
Con Unstable compiler
Compiler continues to have many bugs, and is comparitively slow to compile code with sub-optimal quality of output (Large number of hint errors)