What’s the difference between Typescript and Javascript?

Jennifer Yoo
2 min readJan 12, 2021

If you are a new to coding, it’s highly possible you’ve heard of Javascript. It is one of the most popular language used today. To put it simply, Javascript is a language which creates interactive web pages.

Typescript was developed, as a typed subset to Javascript, to fill the gap as an object orientated language when Javascript grew as a client side language. The open source Typescript command-line complier can be installed as a Node.js package. Typescript shares the same syntax and runtime behavior as Javascript. Essentially, this means that your existing JS code is also TS code.

Typescript code needs to be complied while Javascript code does not. TS can be run on any browser and supports JS libraries.

Fun fact: if you use Visual Studio Code for coding, Typescript is running under the hood to make it easier to work with Javascript.

Typescript allows adding of static type definitions. It works by checking types and its assignments, lowering the chance of bugs.

Typescript knows variable helloWorld is a string

Typescript checks a program for errors before execution. This is called static checking. TS can also determine an error based on the kinds of values being operated on, which is known as static type checking.

An example of static type error on ‘height’

This allows for highly productive development with possibilities for less bugs and easily detect errors statically.

--

--