TypeScript — From JavaScript to Safe Contracts
Migrate working JavaScript into explicit, maintainable contracts and understand where compile-time safety ends.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Check the mental models before the project
Answer from memory. If two options sound similar, explain the boundary difference before choosing.