What is TypeScript?

TypeScript is a typed superset of JavaScript that compiles directly to regular JavaScript which Microsoft created to enable JavaScript developers to code with type safety. This is important because coding with type safety allows developers to code more cleanly which results in easier maintenance and fewer bugs. It is a great tool to add to your next web project that will save your team time and energy both in the development and support phases.

Benefits

TypeScript’s most significant benefit is the type system that gives it its name. By enabling compile-time error-checking, TypeScript dramatically decreases the frequency of run-time errors. This is especially important as web applications become more front-end focused, and consequently the amount of JavaScript code grows considerably. Writing type safe JavaScript code has become important for the exact reasons as its importance on the back-end – it’s easier to maintain and has fewer bugs. And beyond simple type safety, TypeScript’s language paradigms, especially surrounding inheritance, are similar to those found in mainstream back-end languages like Java and C#, cutting down on possible mistakes with junior developers who might not be familiar with advanced JavaScript features (such as prototypical inheritance). These benefits make it less likely your code will fall victim to the dreaded “spaghetti code” complex that can affect large JavaScript projects that weren’t organized with experience and foresight.

Considerations

Though TypeScript is a powerful developer tool that creates better code and fewer bugs, there are a couple of things worth thinking through before choosing to work with TypeScript. The first is that TypeScript is a relatively new technology. JavaScript currently has better IDE and debugger support than found with TypeScript, though this will change over time. Also, TypeScript does a great job masking JavaScript’s idiosyncrasies, but sometimes you will encounter complex or unusual functionality which may require knowledge of underlying JavaScript mechanisms.

Popularity

As TypeScript gains in popularity, tooling support will swiftly improve and the web development community will shift more towards TypeScript.  The next version of Angular, arguably the most popular JavaScript framework, is written in TypeScript.

Best Use Cases

TypeScript is an excellent tool for front-end web development, bringing type safety, better organization, and fewer bugs to your projects. Anyone looking to start a new front-end-heavy web application (or overhauling an old one) should strongly consider using TypeScript to create a quality code foundation that will save time on development and support.

Growing Popularity

Google Trends graph displaying TypeScript’s growth in popularity from January 2013 to January 2016.
TypeScript_GoogleTrends