DEV Community

Cover image for TypeScript
Programmer Sajeeb
Programmer Sajeeb

Posted on

TypeScript

What is 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 are trying to find our bug in the whole JavaScript code. JavaScript can't directly show the exact error. TypeScript removes this problem by checking for any issue at compile time.

The main advantages of TypeScript:

  1. Strict typing
    Everything stays the way we define it. Need a variable to always be a number? It’ll always be a number, then.

  2. Structural typing
    Indispensable when you care about fully defining the actual structure you use. JavaScript allows for a lot of strange things to be done, so relying on a specific structure is a much safer solution.

  3. Type annotations
    A handy way of saying explicitly what type should be used.

  4. Type inference
    Implicit typing performed by TypeScript itself, so that your developers don’t need to provide types where the compiler can find them on its own.

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.

Top comments (0)