Programming & Web DevelopmentIntermediate

TypeScript for JavaScript Developers

Types, generics, narrowing and migrating a real codebase.

Taught by Anisha Rai · Senior Software Engineer

What you'll learn

  • Configure a TypeScript project with tsc, strict mode and typescript-eslint
  • Model data with interfaces, type aliases, unions and literal types
  • Narrow union types safely with type guards, discriminated unions and exhaustive checks
  • Write reusable generic functions and types with constraints and keyof
  • Transform types with utility, mapped and conditional types instead of duplicating them
  • Migrate a JavaScript codebase to TypeScript incrementally using allowJs, checkJs and JSDoc

About this course

TypeScript is now the default for professional JavaScript work, from React frontends to Node.js APIs. This course is for developers who are comfortable with modern JavaScript, including arrow functions, modules, promises and classes, and want to write TypeScript with real confidence rather than sprinkling any across their code. You will learn how the type system thinks: inference, structural typing, interfaces and type aliases, union types and narrowing, generics, utility types, mapped and conditional types, and the satisfies operator. You will configure tsconfig for strict mode, set up tsc and typescript-eslint, and validate untrusted data at runtime with Zod so your types stay honest. The final lesson walks through a step-by-step strategy for migrating an existing JavaScript codebase to TypeScript without stopping feature work. By the end you will read type errors fluently and design types that catch bugs before your users do.

Course content

7 lessons
  1. 1Why TypeScript: The Type System in PracticeWhat TypeScript adds to JavaScript, how inference works and how to set up a strict project.Preview
  2. 2Modelling Data with Interfaces and Type AliasesDescribe objects, functions and unions with interfaces, type aliases, literal types and readonly.
  3. 3Narrowing and Discriminated UnionsUse type guards, control-flow analysis and exhaustive checks to handle every case safely.
  4. 4Generics: Reusable, Type-Safe CodeWrite functions and types that work for many types while keeping full type information.
  5. 5Utility, Mapped and Conditional TypesDerive new types from existing ones with Partial, Pick, Omit, mapped types and satisfies.
  6. 6Strictness, Tooling and Runtime ValidationTune tsconfig, lint with typescript-eslint and validate external data with Zod.
  7. 7Migrating a JavaScript Codebase to TypeScriptA step-by-step, low-risk strategy for moving a real project to TypeScript without a freeze.