CodeRigor

COURSE / REAL PRACTICE

TypeScript foundations

Add explicit contracts to JavaScript, narrow unknown data and migrate the existing JSON report CLI with real compiler diagnostics and runtime checks.

Lessons & exercises6 authored lessons3 units
Start with the first lesson.

Read the explanation and diagrams, then work through the practice. Your browser profile supplies your saved progress.

What you’ll work toward

Compile a tested TypeScript version of the existing JSONL job-report tool, preserve its streams/exit codes and compare its output with the JavaScript baseline. Exercise actual negative type checks and runtime validation separately.

Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.

Before you start

This course builds on these skills:

Individual lessons can add prerequisites. Your lesson progress shows your actual readiness.

A look inside the first lesson

Add annotations without changing the runtime contract

Practice directly with the supplied editor and exercise fixtures in the first lesson.

Your lesson sequence

Follow the same units and lessons in either view. Prerequisite links and your practice progress stay with each lesson.

UNIT 013 lessons Contracts and typed structures
  1. LESSON 01.01

    Add annotations without changing the runtime contract

    Use inferred local values and explicit function boundaries; preserve finite nonnegative duration behavior.

    Open lesson
  2. LESSON 01.02

    Model objects, arrays and optional properties

    Keep readonly inputs, fresh output objects and the distinction between an absent label and an empty string.

    Open lesson
  3. LESSON 01.03

    Narrow unknown with discriminated unions

    Use a runtime test to produce a tagged decision, then let control-flow analysis narrow each branch.

    Open lesson
UNIT 022 lessons External data and reusable tooling
  1. LESSON 02.01

    Validate external data at runtime

    Treat parsed JSON as unknown and construct a canonical Job only after checking its actual fields.

    Open lesson
  2. LESSON 02.02

    Write a small generic and use a local compiler

    Keep input/output type relationships with a generic mapping helper and verify real strict compiler diagnostics.

    Open lesson
UNIT 031 lesson Migrate the JSON report CLI
  1. LESSON 03.01

    Migrate the JSON report CLI and prove parity

    Preserve the original JavaScript CLI’s flags, physical line errors, overflow policy and deterministic output.

    Open lesson