Introduction to Typescript

A quick overview of what Typescript is, features of this powerful language, and how to get started with it.

What is Typescript

TypeScript is a strongly-typed superset of JavaScript. TypeScript adds static types to JavaScript. TypeScript uses JavaScript and C# syntaxes and complies with native JavaScript. Today, TypeScript is being used to build large open-source projects.

TypeScript cannot run directly in the browser, instead the TypeScript code we write gets compiled into Javascript code, which can run directly in the browser. Any valid .js file can be renamed to .ts and compiled with other TypeScript files.

I will say, think of typescript as your friend who sits beside you to check your code.

Here are the key features of TypeScript.

  • TypeScript is simple, easy to learn.

  • It can run on any environment Javascript runs on. It doesn’t need a VM(Virtual Machine) or specific runtime environment.

  • TypeScript extends JavaScript syntax, so any existing JavaScript programs work with TypeScript without any changes.

  • supported by most of the popular developer IDEs including Visual Studio, Visual Studio Code, Sublime Text, Atom, Eclipse, Emacs, etc.

  • TypeScript supports OOP features like classes, inheritance, interfaces, generics etc.

  • TypeScript tooling provides auto-completion, type checking and source code documentation.

How to install Typescript

Via npm (Node.js Package Manager) command-line tool

npm install -g typescript

How to check if typescript is Installed

tsc -v

Congratulations! You can start writing typescript.