What’s the difference between Typescript and Javascript?

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 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.

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

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store