Module Recap
Module 01 covered the foundation: what TypeScript is, how the compiler works, and how to write and configure a TypeScript project from scratch. Here is what to take forward.
What you learned
Section titled “What you learned”TypeScript adds a type system to JavaScript. Every value has a type, and the compiler verifies that values are used consistently with their types. Errors are reported at compile time — before any code reaches the browser.
The compiler strips types and outputs plain JavaScript. The browser runs .js files. Type annotations, interfaces, and generics do not survive into the output. TypeScript is a development tool, not a runtime feature.
Type annotations describe contracts. Function parameters always need annotations. Return types are worth annotating on public-facing and async functions. Initialized variables and simple return values can be inferred — let TypeScript do the work.
Type inference means less annotation, not less safety. TypeScript infers types from initial values. Writing annotations where TypeScript can already see the type adds noise without adding safety.
tsconfig.json configures the build. strict: true, noEmitOnError, outDir, and lib: ["ES2020", "DOM"] are the settings that matter most for a browser-based project.
How this connects to AceIt
Section titled “How this connects to AceIt”AceIt’s tsconfig.json is the configuration you wrote in Lesson 05 — the same file the project uses throughout the course. Every option you set has a reason:
strict: trueensures thatnullandundefinedare handled explicitly, and that every parameter has a type — which matters when you are processing API responses that might be missing fields.lib: ["ES2020", "DOM"]makesfetch,document.querySelector, andlocalStorageavailable to the type checker.noEmitOnErrorensures thedist/folder only contains code that passed type checking.
In the next module you will add the types that describe AceIt’s data — the shape of a trivia question, the possible difficulty values, the API response from Open Trivia DB. Those types will be checked against the configuration you set up here.
Key terms
Section titled “Key terms”| Term | What it means |
|---|---|
| Type annotation | : string, : number, etc. — a label you add to tell TypeScript what type a value is |
| Type inference | TypeScript’s ability to determine a type automatically from context |
| Compile-time error | An error the TypeScript compiler reports before code runs |
tsc | The TypeScript compiler — turns .ts files into .js files |
tsconfig.json | The project-level configuration file for the TypeScript compiler |
strict | A compiler flag that enables the full set of type-safety rules |
any | A type that disables checking — use sparingly |
What is next
Section titled “What is next”Module 02 covers the types that describe AceIt’s data: string, number, and boolean primitives; typed arrays; object types; union types for values that can be one of several things; and enums for the fixed set of difficulty levels the app supports.