TypeScript's roots go as far back as 2012. Since then, the subset has been evolving with new features and tools, and this has made it popular with developers across the world.
New TypeScript 2.0 Features
TypeScript 2.0 brings a number of new features with the goal of enhancing productivity, providing wider support for different languages, and improving the editing experience.
Here's an explanation of some of the most noteworthy ones:
- “Control Flow Analysis for Types: In 2.0, we've started using control flow analysis to better understand what a type has to be at a given location.
- Easier Module Declarations: Now you can import any path that starts with
foo/and TypeScript will assume it exists. You can take advantage of this if your module loader understands how to import based on a certain pattern too. Now whenever you import a path ending with
!text, TypeScript will understand that the import should be typed as a
- Non-nullable Types: Before TypeScript 2.0,
undefinedwere in the domain of every type. That meant that if you had a function that took a
string, you couldn't be sure from the type alone of whether you actually had a
string– you might actually have
null. In TypeScript 2.0, the new
--strictNullChecksflag changes that.
According to Microsoft, many of these changes are thanks to the dedicated community. The service has grown from 275,000 downloads a month to over 2 million. Furthermore, the GitHub project has over 2000 comments, 1500 issue logs, and code from over 150 users.
You can try out TypeScript for yourself by downloading it here.