Ts

Getting Started with TypeScript

Up to date (Apr '17) TypeScript
PRO

This tutorial was made by Stephen Rodriguez — you can follow him on Twitter!

Typescript is an impressive and powerful programming language created by Microsoft. As a superset of the Javascript language, Typescript provides developers the ability to create strongly typed Javascript code. Although most object-oriented languages like Java have this feature supported as part of their core, other languages like Python, and Javascript do not.

Typescript is the missing piece in a very long battle to provide better clarity, and quality for the Javascript language itself. Typescript, at its very core, is Javascript, but extends the language to provide us support for defining variable types, generics, classes, interfaces, namespaces, and so much more.

Code editors like VS Code make it easy to begin using Typescript today, and provide a wide range of documentation and tools to further ease use. I strongly recommend taking a look at the Typescript homepage to learn more about what is Typescript and how you can begin using it today.

Why TS and not other strongly-typed language like Flow or Better.js?

Of course there are other options out there but would coding be fun if there were no competitors? Thus, we need to focus on what problem all of these languages are trying to solve. At Thinkster, we believe that Typescript, amongst its competitors, has proven itself to be the right tool for this problem. The problem can be being described as the following:

We need a framework to enhance the Javascript language in an effort to give developers the ability to create highly-defined, and strongly-typed codebases with as little complexity as possible

That problem description is quite lengthy, but in short, we need a language that does more than just enhances the Javascript language, it also needs to help us write better code. And that is why we, along with our friends at Google, chose Typescript as their language of choice for Angular 2.

What is a Transpiler?

In short, a Transpiler is a tool that converts code from one source language to another. Transpilers, also known as “source-to-source” compilers, are not the same as compilers. Compilers are something that have been around for ages. The purpose of a compiler is to convert higher-level languages like Java into lower-level languages like Assembly. A Transpiler on the other hand, is not like this at all. Their primary focus is not to convert, but rather to interpret.