<aside> 👉 Feel free to check out the video if you missed lecture.


Typescript | Frontend Lecture 11

<aside> 👉 Please download this before the lecture and follow along!





REPL.it link:


Typescript is a static type object-oriented programming language maintained by the Microsoft. It can be seen as a superset of Javascript. With the help of Typescript Compiler(TSC), we can convert typescript code to javascript and then it would be made understandable for the browser / node.

So, why do we need typescript if we can directly write in javascript? There are scenarios where javascript may not function that well.

As a result, typescript is gaining its popularity nowadays. It's crucial to understand typescript in a deeper level.



The biggest difference between JS and TS is the addition of static type checking.

function greeter(person) {
    return "Hello, " + person;

This is a normal javascript function. Let's see how should we rewrite it in typescript.

function greeter(person: string) {
    return "Hello, " + person;

If we try to put a different type as the person parameter, for example greeter([1,2,3]), we will get: