Before you begin
Prerequisites
Hidden — select the eye to show
Block 03 · TYPED JAVASCRIPT PATH
Seventeen imported modules from first type annotations through advanced conditional and mapped types.
Before you begin
Hidden — select the eye to show
What you will master
Hidden — select the eye to show
Final proof of skill
Hidden — select the eye to show
Completion standard
Hidden — select the eye to show
Progress one module at a time
TypeScript is a language developed by Microsoft in 2012 — it is JavaScript with a type system. You specify what types your variables, functions, and objects should hold, and TypeScript compiles ("transpiles") that down to plain JavaScript that runs anywhere JS runs.
TypeScript's core primitives are string (text), number (any numeric value — int, float, hex), and boolean (true/false).
Arrays hold multiple values of the same type — TypeScript enforces this at compile time.
An interface defines the shape of an object — which properties it has, their types, and whether they are optional or readonly. Interfaces are reusable and can be extended.
Functions are reusable blocks of code. In TypeScript you can explicitly type parameters and return types, preventing errors like passing the wrong argument type or misusing a return value.
Union types let a variable hold values of more than one type using the | (pipe) operator.
Classes are blueprints for creating objects. TypeScript adds access modifiers and strict typing on top of JavaScript classes.
Generics let you write reusable code that works with different types while staying type-safe. They use the <T> syntax.
Enums let you define a set of named constants, making code more readable and self-documenting.
Type narrowing is how TypeScript figures out a more specific type from a broad one using guards or assertions.
Modules split code into separate files using export and import.
TypeScript ships with built-in generic helper types: Partial, Required, Pick, Omit, Record, ReturnType, NonNullable.
Decorators are functions that wrap other code. They start with @ and sit above a class, method, property, or parameter.
TypeScript uses tsconfig.json to understand how to compile your project. Generate it with `tsc --init`.
TypeScript enhances React with typed props, typed state, typed refs, and typed events.
TypeScript works seamlessly with Node.js and Express for type-safe server code.
The deep end of TypeScript: conditional types, mapped types, template literal types, and infer.
Use strict mode, unknown, never, discriminated results, exhaustive checks, and safe error boundaries.
Separate compile-time types from untrusted runtime data and validate API boundaries before values enter the application.
Test typed functions, design dependency boundaries, use fakes, and keep domain logic independent from frameworks.
Combine strict types, generics, validation, modules, tests, and framework integration in one production-style application.