What is TypeScript?

Typescript 15, Oct 2023

TypeScript is a strongly typed superset of JavaScript created by Microsoft that adds optional types, classes, async/await and many other features, and compiles to plain JavaScript. Angular is written entirely in TypeScript as a primary language. You can install TypeScript globally as

npm install -g typescript  

Let's see a simple example of TypeScript usage:

function greeter(person: string) {
    return "Hello, " + person;
}
let user = "Sudheer";
document.body.innerHTML = greeter(user);

The greeter method allows only string type as argument.