Guided Course · Foundation

TypeScript — From JavaScript to Safe Contracts

Migrate working JavaScript into explicit, maintainable contracts and understand where compile-time safety ends.

Track project: Migrate TaskFlow Lite to TypeScript. Finish the lessons, then close the transcript and build the project using evidence instead of copy-paste. Open project →
01

Type Inference and Annotations

Here’s the simple reason this matters: Type inference lets TypeScript discover useful types from values and control flow so you do not have to annotate everything manually. In this course, we connect it directly to the contracts that make TaskFlow code safer before it reaches runtime, so you can see where the idea lives in a real project instead of memorizing a definition.

≈ 1892 words
02

Object Types

Here’s the simple reason this matters: This lesson is about Object Types. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that the object must satisfy the declared required fields while `dueAt` remains optional. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 1915 words
03

Type Aliases vs Interfaces

Here’s the simple reason this matters: This lesson is about Type Aliases vs Interfaces. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that aliases conveniently name unions/primitives while interfaces provide an object contract that can extend another interface. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 2022 words
04

Literal Types and Unions

Here’s the simple reason this matters: This lesson is about Literal Types and Unions. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that only the three declared literal values are accepted. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 1963 words
05

Control-Flow Narrowing

Here’s the simple reason this matters: This lesson is about Control-Flow Narrowing. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that the `typeof` check narrows each branch so number- and string-specific operations are safe. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 1920 words
06

Discriminated Unions

Here’s the simple reason this matters: A discriminated union gives each variant a stable tag such as `status`, allowing TypeScript to narrow safely and making impossible states harder to represent. In this course, we connect it directly to the contracts that make TaskFlow code safer before it reaches runtime, so you can see where the idea lives in a real project instead of memorizing a definition.

≈ 1876 words
07

Generics

Here’s the simple reason this matters: This lesson is about Generics. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that the generic keeps the page wrapper reusable while preserving the concrete item type. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 1891 words
08

unknown vs any

Here’s the simple reason this matters: `unknown` means “a value exists but I must prove what it is before using it.” `any` disables that safety and should be treated as an escape hatch. In this course, we connect it directly to the contracts that make TaskFlow code safer before it reaches runtime, so you can see where the idea lives in a real project instead of memorizing a definition.

≈ 1888 words
09

never and Exhaustiveness

Here’s the simple reason this matters: `never` represents a state that should be impossible. Exhaustiveness checks use it to make the compiler warn when a new union variant is not handled. In this course, we connect it directly to the contracts that make TaskFlow code safer before it reaches runtime, so you can see where the idea lives in a real project instead of memorizing a definition.

≈ 1910 words
10

Utility Types

Here’s the simple reason this matters: This lesson is about Utility Types. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that utility types derive related contracts while keeping the relationship to the source model explicit. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 1936 words
11

Function Contracts

Here’s the simple reason this matters: This lesson is about Function Contracts. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that the function contract constrains both its accepted input and returned shape. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 1908 words
12

API Request and Response Types

Here’s the simple reason this matters: This lesson is about API Request and Response Types. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that the types document compile-time expectations for code, but the incoming JSON still needs runtime validation. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 2074 words
13

The Runtime Validation Gap

Here’s the simple reason this matters: TypeScript types disappear at runtime. Data from HTTP, forms, files, environment variables, or databases still needs runtime validation at trust boundaries. In this course, we connect it directly to the contracts that make TaskFlow code safer before it reaches runtime, so you can see where the idea lives in a real project instead of memorizing a definition.

≈ 1915 words
14

TypeScript + Zod Boundary

Here’s the simple reason this matters: This lesson is about TypeScript + Zod Boundary. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that zod validates unknown runtime data and the parsed value receives an inferred safe TypeScript type. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 1982 words
15

Migrate TaskFlow Lite to TypeScript

Here’s the simple reason this matters: This lesson is about Migrate TaskFlow Lite to TypeScript. Keep the idea practical: in safe compile-time contracts around TaskFlow code, the worked example should show that the migrated core state and operations have explicit contracts and compile under strict TypeScript settings. Once you can explain why that happens, the name is much easier to remember. We connect it to the course project so you can see the idea working instead of memorizing a definition.

≈ 2063 words
Track knowledge check

Check the mental models before the project

Answer from memory. If two options sound similar, explain the boundary difference before choosing.

0/0 correct · 0/10 answered
01Which statement best explains “Type Inference and Annotations” in this track?
02Which statement best explains “Object Types” in this track?
03Which statement best explains “Type Aliases vs Interfaces” in this track?
04Which statement best explains “Literal Types and Unions” in this track?
05Which statement best explains “Control-Flow Narrowing” in this track?
06Which statement best explains “Discriminated Unions” in this track?
07Which statement best explains “Generics” in this track?
08Which statement best explains “unknown vs any” in this track?
09Which statement best explains “never and Exhaustiveness” in this track?
10Which statement best explains “Utility Types” in this track?
Ready to transfer the skill?

Migrate TaskFlow Lite to TypeScript

Move the working JavaScript TaskFlow Lite into TypeScript without hiding the runtime boundaries.

Start track project →