---
title: "TypeScript — ZudoJS Academy"
description: "Add a type system to JavaScript: what TypeScript is and is not, everyday types and inference, unions and narrowing, interfaces, generics, classes, modules, tsconfig, and where types stop and runtime validation begins."
source: https://zudojs.oyinlola.site/learn/typescript
---

LEVEL 5 · TYPESCRIPT

Course Foundation

# TypeScript

Add a type system to JavaScript: what TypeScript is and is not, everyday types and inference, unions and narrowing, interfaces, generics, classes, modules, tsconfig, and where types stop and runtime validation begins.

- **21 lessons**
- **15 h** to read and try
- **Before this:** [JavaScript fundamentals](https://zudojs.oyinlola.site/learn/javascript)

0 of 21 lessons done

[Start lesson 1 →](https://zudojs.oyinlola.site/learn/ts-setup)

## When you finish, you can

- Explain type erasure and why types never validate outside data
- Type functions, objects, arrays and tuples, and know when to let inference work
- Model domain states with literal and discriminated unions
- Narrow unknown values safely with guards and assertion functions
- Write generic functions, interfaces and classes
- Configure a project with tsconfig.json and strict mode
- Validate external data at runtime and return typed errors

**You build:** A typed task manager and a typed CLI calculator

MODULE 1

## Why TypeScript

1. [1**Why TypeScript exists**See a bug that JavaScript runs without complaint, install TypeScript, write a tsconfig.json, and learn the three ways to run TypeScript on Node.js 24.35 min](https://zudojs.oyinlola.site/learn/ts-setup)
2. [2**What the TypeScript compiler does**Follow a TypeScript file through tsc: checking, type erasure, transpiling to older JavaScript, emitted files, watch mode and Node's type stripping.45 min](https://zudojs.oyinlola.site/learn/ts-compiler)

MODULE 2

## Everyday types

1. [3**Basic types**The everyday types of TypeScript - strings, numbers, booleans, arrays, tuples and object types - plus any vs unknown, null and undefined under strict mode, void, and never for exhaustive checks.35 min](https://zudojs.oyinlola.site/learn/ts-types)
2. [4**Type inference in depth**See how TypeScript works out the types you never wrote (literals, widening, contextual typing, inferred returns) and decide where an annotation pays off.40 min](https://zudojs.oyinlola.site/learn/ts-inference)
3. [5**Typing functions**Give functions parameter and return types, use optional, default and rest parameters, describe functions and callbacks as types, type async functions with Promise, and meet overloads.35 min](https://zudojs.oyinlola.site/learn/ts-functions)
4. [6**Interfaces, unions and literal types**Name object shapes with interfaces and type aliases, mark properties optional or readonly, extend and combine shapes, and model data that can take several forms with unions, literal types and discriminated unions.40 min](https://zudojs.oyinlola.site/learn/ts-objects)
5. [7**Union types in depth**Model real states with discriminated unions, return typed results instead of throwing, combine shapes with intersections, and avoid common union mistakes.50 min](https://zudojs.oyinlola.site/learn/ts-unions)
6. [8**Type aliases and interfaces**Name your domain types once, extend them safely, use declaration merging and recursive types, and learn the real differences between type and interface.45 min](https://zudojs.oyinlola.site/learn/ts-aliases-interfaces)

MODULE 3

## Special types and narrowing

1. [9**Special types: any, unknown, never and friends**Learn what any, unknown, never, void, object, {} and Object really mean, watch one any spread, and use unknown at your program's boundaries.45 min](https://zudojs.oyinlola.site/learn/ts-special-types)
2. [10**Narrowing**Turn wide union and unknown types into precise ones with typeof, truthiness, equality, in, instanceof, discriminants, type guards and assertion functions, and learn where narrowing lies.50 min](https://zudojs.oyinlola.site/learn/ts-narrowing)
3. [11**Type assertions**Learn what as, angle-bracket assertions, as unknown as and the non-null ! really do, see why none of them check or convert anything, and replace them with safer tools.40 min](https://zudojs.oyinlola.site/learn/ts-assertions)
4. [12**Enums and their alternatives**Write numeric, string and const enums, read the exact JavaScript tsc emits for each, learn the pitfalls and erasableSyntaxOnly, and replace enums with unions and as const objects.45 min](https://zudojs.oyinlola.site/learn/ts-enums)
5. [13**Tuples**Type fixed-shape arrays with tuples - optional, rest and named elements, readonly tuples, tuple inference and const type parameters - and return tuples from functions the way useState does.40 min](https://zudojs.oyinlola.site/learn/ts-tuples)

MODULE 4

## Generics and type operators

1. [14**Generics**Write one function, interface or class that works for many types without losing type safety, set rules with constraints and keyof, give type parameters defaults, and build a Result type and a generic repository.35 min](https://zudojs.oyinlola.site/learn/ts-generics)
2. [15**Designing generic APIs**Design generic interfaces and classes that stay easy to call - type parameters that earn their place, inference, NoInfer, keyof constraints and defaults - by building Repository, Result, Page, ApiResponse, Cache and typed events.55 min](https://zudojs.oyinlola.site/learn/ts-generic-design)
3. [16**Advanced and utility types**Build new types from existing ones with keyof, typeof, indexed access, mapped, conditional and template literal types, and use the built-in utility types (Partial, Pick, Omit, Record, ReturnType, Awaited and more) to keep one source of truth.45 min](https://zudojs.oyinlola.site/learn/ts-advanced)

MODULE 5

## Classes, modules and configuration

1. [17**Classes in TypeScript**Declare typed class properties, use parameter properties and access modifiers, compare private with #private, write abstract classes and classes that implement interfaces, and wire classes together with constructor injection.40 min](https://zudojs.oyinlola.site/learn/ts-classes)
2. [18**Modules in TypeScript**Split a TypeScript project into files, import types with import type, see why verbatimModuleSyntax exists, write .js in import paths, and understand how NodeNext resolution, "type" - "module" and the "exports" field fit together.40 min](https://zudojs.oyinlola.site/learn/ts-modules)

MODULE 6

## Types meet the runtime

1. [19**TypeScript and JavaScript together**See exactly what TypeScript becomes when it runs, why types cannot check outside data, and how to close that gap by hand with type guards, assertion functions and a validator that returns a Result.45 min](https://zudojs.oyinlola.site/learn/ts-runtime)
2. [20**Typed error handling**Catch errors as unknown, write error classes with a name, a cause and a literal code, return typed results, and handle async failures in a payments service.55 min](https://zudojs.oyinlola.site/learn/ts-errors)
3. [21**Async TypeScript**Type promises and async functions precisely, keep Promise.all tuples intact, narrow allSettled results, use Awaited, and page through an API with typed async generators.55 min](https://zudojs.oyinlola.site/learn/ts-async)

## Course checkpoint

Prove you can move on. The checkpoint picks 20 questions at random from every lesson in this course. Get 16 right to pass. Your result is saved in this browser only.
