Whether you’re a JavaScript beginner, expert or fanatic—now is a great time to learn TypeScript, a programming language designed to make JavaScript strongly typed and capable of supporting large-scale web applications. TypeScript is a superset of JavaScript, and its recent release, TypeScript 2.0, adds extra features, such as glob support, to make a developer’s life easier. It provides the flexibility to write JavaScript programs that can grow over time without becoming too unwieldy and frees you to concentrate on learning JavaScript frameworks, such as Express and Angular, that empower you to build both RESTful web services and modern client applications.
I just authored a new 5-day course on TypeScript—Essential TypeScript 2.0 with Visual Studio Code—a culmination of a four-month odyssey in which I not only had to learn TypeScript grammar and syntax, but also master an entirely new technology stack and toolchain. Here is a list of topics included in the course:
- Introduction to TypeScript
- TypeScript Language Basics
- Using Visual Studio Code with TypeScript
- Task Automation, Unit Testing, Continuous Integration
- The TypeScript Type System
- Functional Programming
- Asynchronous Programming
- Object-Oriented Programming
- Generics and Decorators
- Namespaces and Modules
- Practical TypeScript with Express and Angular
I thoroughly enjoyed the process of adding a new weapon to my arsenal as a software developer and the chance to venture off in an entirely new direction. Here are four reasons why now is the right time for you to learn TypeScript.
1. Revenge of JavaScript
A compelling reason to learn JavaScript is that it can be used to write apps for more than just web browsers–you can use it to write desktop and mobile apps, as well as back-end services running in the cloud. JavaScript has unwittingly become one language to rule them all.
Web development has also matured to the point where it’s possible to write an app that has nearly the same interactivity and responsiveness as a traditional desktop application. With the advent of Single Page Applications (SPAs), turbocharged JavaScript engines quickly render rich, interactive web pages. It’s the perfect time to build SPAs because second generation frameworks have emerged that take web development to a whole new level and implement the Model-View-ViewModel (MVVM) pattern (or some MV-* variation), providing benefits such as better separation of concerns, testability and maintainability. Frameworks like Angular, Aurelia and React-Redux also provide tools for quickly scaffolding new applications and preparing them for production.
TypeScript has emerged as the language of choice for building many of these kinds of modern web apps because strong typing enables features we take for granted, such as interfaces and generics. It also provides capabilities most developers couldn’t live without, such as intellisense, statement completion and code refactorings.
2. JavaScript Has Grown Up
In 2015, JavaScript had its most significant upgrade since it was created in 1995 by Brendan Eich in a 10-day hackathon. With the release of ECMAScript 2015, JavaScript received a slew of new features, including classes, inheritance, constants, iterators, modules and promises. TypeScript not only includes all ES 2015 features, but it fast forwards to future versions of ECMAScript by supporting proposed features such as async and await operators, which help simplify asynchronous code. TypeScript lets you use advanced features of JavaScript by transpiling down to ES5, a flavor of JavaScript compatible with most browsers.
When you put modern JavaScript together with TypeScript, you get a powerful combination that gives you just about everything you might want for building SOLID applications that can run in the browser, on the server or on mobile and desktop platforms.
3. Shiny New Tools
The nice thing about TypeScript is that you’re free to use whatever tool you like, from a full-fledged IDE like Visual Studio or Web Storm, to a lightweight code editor, such as SublimeText, Atom, Brackets or Visual Studio Code. While there’s nothing wrong with any of these options, I prefer using VS Code for TypeScript development because it comes with TypeScript in the box and the team eats their own dog food by using TypeScript to build the editor.
Coming from a C# background, where I was confined to using Visual Studio on Windows, I appreciate being able to run VS Code on my Mac. VS Code starts quickly and I can open it at a specific folder from either the Finder or Terminal. I also found navigation in VS Code to be straightforward and intuitive, and you can perform many tasks from the command palette, including custom gulp tasks. VS Code functions as a great markdown editor with a side-by-side preview that refreshes in real time as you make changes. It has Git integration and debugging support, as well as a marketplace of third-party extensions that provide a variety of nifty services, such as TypeScript linting and Angular 2 code snippets. Put it all together and VS Code is a perfect fit for TypeScript development.
4. Living in Harmony
One of the most compelling reasons I can think of for picking up TypeScript is that it’s the brainchild of the same person who created C#, Anders Hejlsberg, who also invented Turbo Paschal and Delphi. Having such an amazing track record, I have a high degree of confidence in following him into the world of web and native JavaScript development. Anders has made it possible to be more productive and write code that is more resilient because the TypeScript compiler is able to catch problems at development time that would otherwise only become apparent at runtime.
Lastly, it’s significant that Anders did not choose to create a language that is different than JavaScript, such as CoffeeScript, but rather one that includes all of JavaScript with optional type annotations that disappear when TypeScript is compiled down to plain old JavaScript. In fact, all JavaScript is valid TypeScript, and you can insert annotations or leave them out wherever you like, giving you the best of both dynamic and static typing. In other words, TypeScript does not dictate that you follow any of its prescriptions.
All in all, the latest version of TypeScript gives developers what they pine for—additional features that create flexibility, productivity and power. But most importantly, it creates less headaches. I look forward to you joining me in the Essential TypeScript 2.0 with Visual Studio Code course to discover TypeScript’s capabilities.
Happy coding!
Related Courses
Essential TypeScript 2.0 with Visual Studio Code