Learn TypeScript

What is TypeScript?

What is TypeScript?

In this lesson, we will start by understanding what TypeScript is and understand its usage today.

JavaScript that scales

TypeScript is built and maintained by Microsoft. Microsoft's strapline for TypeScript is JavaScript that scales because it helps write large JavaScript based programs.

TypeScript is a superset of JavaScript. Any feature in JavaScript is available in TypeScript. TypeScript adds a powerful type system to the JavaScript we already know and love. This type system enables code editors to provide code refactoring and navigation features along with type checking. TypeScript helps a JavaScript codebase become more readable and easier to maintain by adding a static type system.

TypeScript is a superset of JavaScript

TypeScript doesn't directly execute in the browser. Like JSX, it needs to be converted to JavaScript first. TypeScript has a compiler that can do this after type checking the code. The Babel compiler can convert TypeScript code to JavaScript as well.

TypeScript is not limited to browser-based apps. It can be used on the backend as well to write nodejs based apps.

TypeScript usage

Mature and still rapidly developing

Typescript was first released in 2012 and so is very mature now. It is still rapidly developing, with at least one release per month.

Powerful and flexible type system

The type system is super flexible, which is essential for writing generic and reusable code. Both Angular and Vue are now using TypeScript to build their frameworks, highlighting just how flexible it is. It also works brilliantly with React!

Migrating to TypeScript from JavaScript can be a gradual process. This is because types in TypeScript are optional, and every JavaScript file is a valid TypeScript file. The TypeScript compiler's strictness is also configurable so that the codebase types can be strengthened over time.

Huge community

TypeScript has a big community that is still growing. Have a look at npm trends and see how TypeScript's usage has increased in the last couple of years.

Summary

Congratulations - you completed the first lesson!

Now that we are starting to understand what TypeScript is, we will begin to understand its benefits in the next lesson.

© 2020 Carl Rippon
Privacy Policy
This site uses cookies. Click here to find out more