TypeScript’s definition from Microsoft:
In this blog I outline the important features and tooling supported by TypeScript. In my next blog I delve into these in detail.
TypeScript supports all the primitive types such as number, string, boolean, null. It also support complex types such as DOM elements, custom types such as JQuery elements and a special type called Any
Similar to other object oriented programs, TypeScript included Class syntax thereby making .NET and object oriented programming developers feel home and easily group related functions and variables within this container. Similar to classes in other programming languages, these classes helps in code abstraction, inheritance, reusability and maintainability.
TypeScript provides properties using get and set accessor declarations. These properties similar to that of the C# or VB.NET
Similar to OO, TypeScript provides Inheritance. The syntax is similar to that of Java with extends and super keywords
Modules are similar to the namespace concept in .NET. They wrap the classes in a naming container, help to organize the classes and modules and avoid naming collisions. They also provide a mechanism to exposes classes or have internal classes.
TypeScript provides accessibility options for classes and their members. The class members’ accessibility can be set by using public and private and the class accessibility can be restricted or allowed using the export keyword.
Both the modules and classes are open ended, meaning you can define them in any place and they all belong to the same class or module. You can think of this like a partial class.
Below are some of the tooling support in Visual Studio:
- Syntax highlighting – TypeScript helps you identify the coding issues while writing code by providing static error messages
- Refactoring and code navigation – Similar to C# or VB.NET, TypeScript has the same great code tools, such as Rename, Go to Definition, Go to Declaration.
- Declaration files – TypeScript uses these files to annotate the types for existing libraries such as JQuery and provide better tooling
Microsoft is planning to add more tooling support such as split screen view, generated code grouping in their next releases.
Try Out TypeScript
Microsoft designed a playground to try out TypeScript and it’s capabilities before deciding to use it in your project. In that playground they also included some samples.
With so many features and tools, TypeScript is must for application development and is too expensive in time for not having TypeScript in your armor.