Linn Linn Htun
Linn Linn Htun
AvatarLinn Linn Htun

What is Typescript?

August 7, 2023

What is Typescript?

TypeScript is a strongly typed programming language that builds on JavaScript by adding optional static types and modern language features. Created by Microsoft, it compiles down to plain JavaScript and runs anywhere JavaScript runs. This post introduces TypeScript's key benefits and why it's become the standard for large-scale JavaScript development.

What is Typescript

Typescript is a programming language to address the shortcomings of Javascript. We can think about brother or sister Javascript.

Benefits

  • Static typing
  • Code completion
  • Refactoring
  • Shorthand notations

 

What is Static Typing?

There are two types of programming languages.

  • Statically-Typed
  • Dynamically-Typed

Statically-Typed

Statically-Typed languages like (C++, C#, Java). We have to know the type of variable while we coding.

For example: 

int number = 10;

This number variable only holds integer value. Can't put any value like string or objects in this variable like below:

number = "a";

Dynamically-Typed

Dynamically-Typed languages like (Javascript, Python, Ruby). A variable is dynamic.

For Example : 

let number = 10;

number = "a";

 

Typescript is essentially Javascript with Type Checking. While we coding with Typescript we should use a compiler like VSCode because the compiler can point out if we doing something wrong with a variable.

 

Code completion

Every browser doesn't know the Typescript code. So, we need a compiler from ts to js.

 

 

Frequently Asked Questions

What is TypeScript and why should I use it?

TypeScript is a superset of JavaScript that adds static type checking, enabling you to catch bugs at compile time, get better IDE support with autocomplete, and write more maintainable code — especially beneficial for larger codebases and teams.

Is TypeScript the same as JavaScript?

TypeScript is a superset of JavaScript — all valid JavaScript is valid TypeScript, but TypeScript adds optional type annotations and other features that are removed when compiled to standard JavaScript.