Benefits of TypeScript
- Optional static typing (the key here is optional)
- Type Inference, which gives some of the benefits of types, without actually using them
- Access to ES6 and ES7 features, before they become supported by major browsers
- Great tooling support with IntelliSense
Because of these awesome features and the huge advantages it gives to you as a developer, Ionic apps are written in TypeScript, instead of ES6.
Optional Static Typing
Most likely, the first thing that comes to mind with TypeScript is the optional static type system that it provides. Types can be added to variables, functions, properties, etc. This will help the compiler and show warnings about any potential errors in code, before an app is ever run. Types also help when using libraries and frameworks, as they let developers know exactly what type of data APIs expect. The key thing to remember about the type system is that it is optional. TypeScript does not force developers to add types they don’t want to add. However, as an app gets larger and more complex, types can provide some great advantages.
One of the biggest advantages of TypeScript is its code completion and IntelliSense. Intellisense provides active hints as code is added. Since Ionic itself is written in TypeScript as well, editors can present all the methods available and what they expect as arguments. All the best IDE’s available today have support for code completion, including VScode, Atom, WebStorm, Sublime text, and even command line editors, such as Vim/Neovim!
TypeScript’s many benefits provide a much better app development experience. Because of this, Ionic is going “all in” on TypeScript, rather than providing ES6 starters.