What is TypeScript?

TypeScript is an open-source programming language which is developed and maintained by Microsoft mainly for writing large applications. It is a superset of JavaScript, and you can also add static typing to it. Ander Hejlsberg was the main contributor in developing this language. If you have existing JavaScript programs, they are also TypeScript programs without any changes. You can use this language for both client side and server side programming.

Compilation of TypeScript Code:

The language code compilation is through TypeScript compiler. The TypeScript language itself is used to write this compiler. The language is included in MS Visual Studio 2013 and later. You can use all JavaScript code, JavaScript libraries and even make calls to other TypeScript functions from existing JavaScript code. The compiled code is a JavaScript code, and you can use it in any web based applications.

The TypeScript Community:

Since the inception of TypeScript, it has grown as a language as well as a community. Apart from millions of downloads, there is the great adoption of the TypeScript nightly builds with a couple of thousand users participating in GitHub discussions. Microsoft has accepted many PRs from many users related to defects, prototypes and new features. The community interest is there because the community is learning new things, getting the advantage of the static type system, as well as the developers, can improve their productivity. Developers working on freelance jobs have advantages due to open source and community networks.

Type Declaration in TypeScript:

The definition files in TypeScript contains information regarding ‘type’ of existing JavaScript libraries. This feature enables other programs to use the values defined using these files. You will also find third party header files for popular script libraries in TypeScript. It includes Node.js as well header file also which you can use for server side programming using TypeScript. The types are very useful for developers in using static checking. They allow you to define an interface between different software components. When you use them in your code, you are also using the existing style and function of the code in JavaScript library.

JavaScript and TypeScript Compatibility:

JavaScript is a constantly evolving language, and new features always get added to JavaScript including the features supported by ECMAScript. TypeScript supports all these features and functions making the scope of this language very wide. When compiled, it gets converted to simple JavaScript and makes it ECMAScript 3 compatible.

Evolution of TypeScript Language:

After the release of TypeScript, the next version was release 1.1, where the compiler was re-written to improve the performance drastically. A new baseline of performance and speed is available now with this compiler. They also decided to migrate the code repository to GitHub and got community engagement in this Project,

As JavaScript was evolving, it was necessary to support ES6 and create support for modules and decorators. At the same time, Microsoft also partnered with Angular 2 and these developments in releases 1.4 ad 1.5 led to making TypeScript an enhanced programming language.

The language further evolved with type improvements in releases 1.6-1.8 adding up more patterns and the support to JavaScript libraries also improved. The error handling capacity also improved with each new release.

The major release was 2.0 where the specifications were closely aligned with ECMAScript and covered full support for JavaSCript libraries. The language has enhanced editing capability within major language editors with this version. We will see more about the latest release in details.

TypeScript 2.0 Specifications:

TypeScript 2.0 is a major release with many new and enhanced features over 1.8. We will see some key features Microsoft added, which directly impact the developers.

Easy Declaration File: The acquisition of .d.ts files officially is going to simplify the way of using these files with the help of Typings and tsd tools. This feature is helpful for new users to quickly get acquainted with this software and manage declaration file dependencies.

Explicit Non-nullable Types: All JavaScript developers will know about the ‘null’ and undefined values. Both values create a lot of errors in coding as the developers often forget to make assumptions about getting these values as return values through their code and services. Now, in the new release; both null and undefined are having their types. Developers can clearly code w.r.t. This change and decide when these values are acceptable. Defining a return value as number or text combined with null is a big step for coders.

Control Flow Analyzed Types: The control flow analysis was there in earlier version also, but now you have more control over it. You can produce specific type at any given time. You can combine this functionality with non-nullable types and can write complex conditions.

Migration from JavaScript to TypeScript:

As soon as there is a better language available in the market, the enthusiastic development community will try to find out whether it is making more sense to migrate their current (old) projects to the new language. In this case, compatibility or crashing of old code is not an issue, but you can see some advantages of this migration (or at least writing new modules using TypeScript)

  • For developers who know JavaScript, there is almost no learning curve
  • As discussed earlier, the static type checking is main advantage
  • As the language is ES6 compatible, you get support of those features
  • JavaScript Packaging support is there by default
  • Being a Superset of JavaScript, you get some additional functions and doesn’t lose anything

Next Steps:

The ‘type’ system is what is great about TypeScript. Microsoft will continue to work on this to evolve it more along with partners, freelance web developers, and the TypeScript community. The language services will also be enhanced, and the language will be made more feature-rich.

Summary:

TypeScript is a type of JavaScript that has evolved for decades, and it further develops. The TypeScript allows developers to use existing JavaScript code, incorporate popular JavaScript libraries, and call TypeScript code from JavaScript. TypeScript’s static types enable JavaScript developers to use highly-productive development tools. Overall, a great programming language with support from Microsoft is going to be a long-time player in the market.

free email signature generator