tracks / python-to-typescript
Python
TypeScript

A guided path for Python developers learning TypeScript.

Move from dynamic Python habits into typed JavaScript contracts.

This track is for experienced Python developers moving into TypeScript for frontend or backend work and needing gradual static modeling, not a JavaScript beginner course. It focuses on type-driven contracts, data modeling, boundary validation, typed tests, and narrowing dynamic data safely.

6 lessons~2.5 hrscomparison-firststatus: stableupdated Apr 2026

before you start

  • $You already write real Python code. This path assumes professional instincts, not beginner-level programming lessons.
  • $Expect comparison-first modules: each stop starts from familiar Python habits, then shows where TypeScript agrees or pushes back.
  • $Plan to practice the target ecosystem directly — syntax, testing, and design choices should feel native by the end, not translated.

by the end you can

  • Read and write idiomatic TypeScript without translating every line back through Python.
  • Spot which Python instincts transfer cleanly and which ones need a different TypeScript mental model.
  • Use the six modules as a working checklist when you build your first real TypeScript tool, service, or feature.

syllabus

6 modules, one capstone.

6 lessons · ~2.5 hrs
module 01
1 lesson · ~25 min

Mindset shift

Reframe TypeScript as a static contract layer on top of JavaScript rather than a direct extension of Python's typing habits.

module 02
1 lesson · ~25 min

Syntax and structure mapping

Map Python functions, dictionaries, modules, and annotations onto TypeScript's function signatures, object types, and module surfaces.

module 03
1 lesson · ~25 min

Data and state modeling

Move from Python's dynamic data shaping into explicit TypeScript models for objects, variants, and state transitions.

module 04
1 lesson · ~25 min

Error handling

Translate Python exception instincts into TypeScript's thrown-error model while learning where unknown and runtime validation belong.

module 05
1 lesson · ~25 min

Testing in TypeScript

Carry Python testing instincts into TypeScript while learning typed fixtures, mocks, and assertion patterns that stay readable.

module 06
1 lesson · ~25 min

Narrowing and unions

Use narrowing and discriminated unions to model flexible real-world data without falling back to untyped Python-style assumptions.

track reference

Keep the shared translation aids in one place.

These are track-wide lookup tables and task patterns, not lesson-specific reading. Use them when you need a quick reset on the recurring source-to-target language translations.

Data type mappings

Recheck the building blocks when a translation starts to wobble.

Python

string

TypeScript

string

Common operations

  • Format values with f-strings in Python and template literals in TypeScript.
  • Use type annotations to make string-based contracts explicit at function boundaries.
  • Remember the type disappears at runtime even though it improves the editor and compiler view.

Python

list

TypeScript

array / T[]

Common operations

  • Append values with list.append(...) in Python and push(...) in TypeScript.
  • Use comprehensions in Python and array pipelines in TypeScript when they stay readable.
  • Model element type explicitly in TypeScript rather than relying on loose runtime mixing.

Python

dict / typed shape

TypeScript

interface or type alias

Common operations

  • Use named object types when the shape is part of the public contract.
  • Use discriminated unions when dynamic payloads have multiple legal shapes.
  • Keep runtime validation separate from the static shape declaration.

Python

None / missing value

TypeScript

union with null or undefined

Common operations

  • Model missing values with unions such as T | null instead of relying on informal conventions.
  • Use unknown at the boundary and narrow before trusting missing-value checks.
  • Keep absence explicit in the type instead of leaving it to convention.

Comparative cheat sheet

Keep the most common tasks visible while you practice.

TaskPythonTypeScript
Define a functiondef greet(name: str) -> str: return f"hello {name}"function greet(name: string): string { return `hello ${name}`; }
Format a stringmessage = f"user={user_id}"const message = `user=${userId}`;
Add to a collectionitems.append(value)items.push(value);
Handle missing valuesif user is None: return Noneif (user === null) { return null; }
Test a functiondef test_slugify(): assert slugify("Hello") == "hello"test("slugify", () => { expect(slugify("Hello")).toBe("hello"); });

capstone

Ship a small TypeScript project that proves the mental model stuck.

Build one focused artifact in TypeScript using the same comparison-first habits from the track: start from a familiar Python shape, then deliberately redesign it the way TypeScript expects.

  • Translate a familiar Python data flow into idiomatic TypeScript structure instead of preserving the old shape by force.
  • Apply the early modules to data modeling, control flow, and API boundaries before you add tooling, polish, or deployment concerns.
  • Use the later modules to verify, test, and package the result the way TypeScript developers expect to see it shipped.

ready?

Start with module 01 — Mindset shift.

Begin