SkillByAIOpen interactive version →

Lesson 1 / 28

Why TypeScript?

Learn what TypeScript adds to JavaScript, why static types catch bugs early, and how to adopt it gradually.

What TypeScript adds

TypeScript is JavaScript plus static types. Every valid JS file is already valid TS — you opt into type checking gradually, and errors surface while you type, not in production.

A spellchecker for code

Plain JS runs your sentence even with a typo and fails later. TypeScript is a spellchecker — it underlines the mistake before you hit "send".

Caught before running

In plain JS this typo runs and silently returns undefined. TS refuses to compile it.

function greet(name: string) {
  return `Hello, ${nmae}!`; // typo: 'nmae'
}
// Error: Cannot find name 'nmae'. Did you mean 'name'?