Recs.
Updated
SpecsUpdate
Pros
Pro Actually used by large projects in the real world
For instance, Angular 2 is written entirely in Typescript.
Cons
Con Less Creativity... If you visualize code execution process in your mind , TS will disrupt it...
Con Removed at build time... so in development, IDE + LS + Ai runtime in background can do better .
Con Is not necessary.. won't work in JS easily, unless you use JS Docs which pollutes code.
the claimed maintainability only applies when a simple/careless developer can't visualize, read and write code correctly, and mess up the code. choose better Devs, in interview ask them to visualize and describe your code. problem solved.
Con Not a language..., is just a tool which must work in background, yet it pollutes your source code logic.
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 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 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.
Recommendations
Comments
Flagged Pros + Cons
Con Interfacing with non-Typescript libraries requires installation of library-specific "definition files"
Con It is not Dart
Use Dart. Dart is a much better language, simpler to understand, better dependency management, static analysis, multi-platform, higher performance across multiple platforms, well designed core libraries, awesome asynchronous features, etc , etc. Use Dart!
Out of Date Pros + Cons
Con Unsound type system
Static type checking is for safety, but when the TypeScript type system is designed to be unsound, the safety guarantee is gone.
See "A Note on Soundness".
Con Microsoft hand
As TypeScript is developed by Microsoft employees ( = employees of Big Stable company), it has tendency to over-complicate things and advocate bad programming patterns, compensating its weaknesses by encouraging teams to assign more developers onto projects.