Benefits

Note: Typescript is a compiled language, it cannot run directly on the browser and Nodejs.

Simple Example

let first_name: string = "Abdul"
let last_name: string = "Fattah"
let age: number = 20

function getFullName(first: string, last: string) {
   return `${first_name} ${last_name}`
}

getFullName(first_name, last_name)
getFullName(first_name, age) // error

interface IBaseEntity {
  id: number
}

interface IUser extends IBaseEntity {
  first_name: string
  last_name: string
}

See on the TypeScript Playground

Built-in Utility Types

TypeScript: Documentation - Utility Types (typescriptlang.org)

The most commonly used and we will use the first three of them in this project: