Angular 2 - Basics of TypeScript


The Angular source code is written in TypeScript. TypeScript is a typed superset of JavaScript that gets transpiled to plain JavaScript. 





Advantages :
Some of the advantages of using TypeScript is that you can write ES2015 classes and use Modules. 

·         TypeScript also provides strong typing for things like variables and function signatures. This helps to aid during development time to ensure your JavaScript, which is a dynamic language by nature, is being written and used as intended. 
·         It is important to note though that using the strong typing is optional, and it is actually completely possible to just write plain JavaScript in a TypeScript file. 
·         Main focus being on writing classes, using decorators, and a bit of function parameter typing that you need to be familiar with.
·         There are two benefits of going with TypeScript to write your angular code. The first is simplicity. By being able to write classes and use decorators you end up writing less code that reads cleaner and is easier to follow.
·         The second is the Angular source code. If you're writing your code in the same fashion as the angular source code, it'll be easy for you to look through the source code as you grow your Angular skills. The ability to reference and learn from the source code as you work on your angular projects will increase your productivity as well as your understanding of the framework. Using the same pattern of writing code, in this case TypeScript, will provide you an accelerated benefit in that area.