DEV Community

Cover image for TypeScript
Alif Ahmed Nowshad
Alif Ahmed Nowshad

Posted on

TypeScript

TypeScript is a strongly typed programming language that builds on JavaScript. It is a superset of Javascript created by Microsoft. It is an updated version of Javascript. TypeScript is an Open Source Project, and the source code for it is available on GitHub.

Why do we use Typescript:

TypeScript solves the largest issue in JavaScript. Javascript shows an error or problem in runtime when we trying to find our bug in the whole javascript code. Javascript can't directly show what is the exact error. TypeScript removes this problem by checking for any issue at compile time.

About typescript:

Typescript is a programming language. so it has its own syntax, variable, function, operator, loop, type, array, object, class, module and etc.

Its data types are string, number, null, undefined, boolean, never, unknown, any.

Arrays method are concat(), every(), filter(), forEach(), indexOf(), join(), map(), pop(), lastIndexOf(), sort(), shift(), unshift(), etc.

Two types of modules.

  1. Internal Modules
    Syntax
    namespace TutorialPoint {
    export function add(x, y) { console.log(x + y);}
    }

  2. External Modules
    Syntax
    //FileName : SomeInterface.ts
    export interface SomeInterface {
    //code declarations
    }

Typescript benefits:

The main benefit of typescript is showing errors before runtime and we can select the type. Its supports modern features of Javascript. TypeScript additional syntax catches errors early in your editor. Its code converts to JavaScript, which runs anywhere like Javascript browser, on Node.js or Deno, and in your apps.

So, we can use typescript in our project because it is save our time to fix bugs and use more features than Javascript. Typescript is becoming popular with programmers day by day.

Top comments (0)