Loading lesson…
TypeScript is JavaScript with types. Learn how `strict` mode catches bugs at compile time and how AI writes cleaner types than you might alone.
A type says: this variable will hold a string, not a number. The compiler checks every line to see if you kept that promise. When you do not, it fails early instead of at 2am.
// Always start with strict mode in tsconfig.json // { "compilerOptions": { "strict": true, "target": "ES2022" } } function greet(name: string, loud = false): string { const msg = `Hello, ${name}!`; return loud ? msg.toUpperCase() : msg; } console.log(greet("Ada")); console.log(greet("Bo", true)); // greet(42); // compile error: number is not stringInference handles most types. You only annotate function signatures and tricky variables.type Status = "idle" | "loading" | "error" | "success"; function label(s: Status): string { switch (s) { case "idle": return "Ready"; case "loading": return "Working"; case "error": return "Try again"; case "success": return "Done"; } }Union of string literals plus a switch gives exhaustive checks. Add a new status and TS tells you where to update.The big idea: turn on strict, annotate the boundaries, and let unions model real-world states. AI reads types better than comments.
6 questions · take it digitally for instant feedback at tendril.neural-forge.io/learn/quiz/end-progx-ts-fundamentals-builders
What is the main idea of "TypeScript Fundamentals With AI"?
Which concept is most central to "TypeScript Fundamentals With AI"?
What should a careful learner remember about "Let TS infer, but annotate boundaries"?
You want to use AI after this lesson. What is the safest next step?
How should AI output about types be treated?
Name one way to verify an AI answer about types.