Introduction to TypeScript

What is TypeScript

A superset of JavaScript is TypeScript. The foundation for TypeScript is JavaScript. You begin by writing the TypeScript code. The TypeScript code is then converted into standard JavaScript code using a TypeScript compiler.

Once you have the basic JavaScript code, you can use it anywhere JavaScript is supported.

TypeScript files use the .ts extension rather than the .js extension of JavaScript files.

In addition to using JavaScript syntaxes, TypeScript also introduces new syntaxes to support types.

A TypeScript program is one that is written in JavaScript and doesn’t have any syntax errors. It means that all JavaScript programs are TypeScript programs. If you’re converting an existing JavaScript codebase to TypeScript, this is really beneficial.

Why do we need TypeScript

Below are the main goals of TypeScript:

  • Introduce optional types to JavaScript.
  • Implement planned features of future JavaScript, a.k.a. ECMAScript Next or ES Next to the current JavaScript.
Optional Type System

TypeScript provides the static type system which provides great help in catching programming errors at compile time. Javascript is a dynamically typed system. The variables can hold any values. The type of variable is determined on the fly. The javascript implicitly converts types for example string to a number. This is ok for a small app, but large apps this can be a lot of headaches. It is difficult to test to see if the proper types are passed and errors always happen at runtime.

Intellisense & syntax checking

The static Type system contributes to greater IDE tools support. Among the many advantages of the tools support are intellisense, syntax checking, and code completion. This shortens the development period and guarantees that the programmers make fewer typographical errors. The tooling support for Typescript is present in all of the major editors, including VSCode, Atom, and Sublime Text.

Maintainable code

Modules, Types, Classes, and Interfaces are provided by Typescript. It improves the code’s scalability and maintainability. Organizing Typescript code is much simpler than organising Javascript code.

Components Of TypeScript

The architecture of TypeScript is neatly organized in different layers as shown in the image below. The three major layers are

TypeScript Components

The main components are –

  • Language what developer writes.
  • Typescript Standalone Compiler
  • Typescript Language Services

TypeScript Is The Future of JavaScript

The current JavaScript engines are supported by TypeScript for the upcoming features contained in ES Next. You can use the new JavaScript features before other environments or web browsers completely support them, in other words.

Every year, TC39 releases several new features for ECMAScript, which is the standard of JavaScript. The feature proposals typically go through five stages:

  • Stage 0: Strawperson
  • Stage 1: Proposal
  • Stage 2: Draft
  • Stage 3: Candidate
  • Stage 4: Finished

And TypeScript generally supports features that are in the stage 3.

Study Reference



    An intriguing discussion is definitely worth comment. I think that you should publish more about this topic, it might not be a taboo subject but generally people do not speak about these subjects. To the next! All the best!!


Submit a Comment

Your email address will not be published. Required fields are marked *