What TypeScript Adds to JavaScript
Learn how TypeScript extends JavaScript with static types.
What TypeScript Adds to JavaScript is a free TypeScript Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the TypeScript Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Welcome
TypeScript Is a Superset
Type Annotations
let name: string = 'Alice';
let age: number = 30;
let active: boolean = true;Compile-Time Type Checking
let count: number = 5;
count = 'hello'; // Error: Type 'string' is not assignable to type 'number'Interfaces and Type Aliases
interface User {
name: string;
age: number;
}
const alice: User = { name: 'Alice', age: 30 };Enums
enum Direction { Up, Down, Left, Right }
const move: Direction = Direction.Up;Generics
function identity<T>(value: T): T {
return value;
}
const n = identity<number>(42);Access Modifiers on Classes
class BankAccount {
private balance: number = 0;
deposit(amount: number) { this.balance += amount; }
}Non-Nullable Types
let name: string = null; // Error with strictNullChecks
let maybeName: string | null = null; // OKTypeScript Erases Types at Runtime
Better IDE Tooling
Quick Check
Recap
Frequently asked questions
Is the “What TypeScript Adds to JavaScript” lesson free?
Yes — the full text of “What TypeScript Adds to JavaScript” is free to read here on the web, and the TypeScript Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the TypeScript Academy course, upgrade to CoddyKit PRO.
What will I learn in “What TypeScript Adds to JavaScript”?
Learn how TypeScript extends JavaScript with static types. You practise TypeScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start TypeScript Academy?
No prior experience is required. TypeScript Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “What TypeScript Adds to JavaScript” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this TypeScript Academy lesson?
Yes. Every TypeScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- JavaScript Pain Points: Runtime Bugs
- What TypeScript Adds to JavaScript
- Compiling TypeScript to JavaScript
- When to Use TypeScript in Your Projects