Menu
CoddyTech
Course

TypeScript for Python Developers

Learn the JavaScript runtime and TypeScript contracts from Python. Practice typed flow, functions, collections and class modules, then build a validated order-processing tool.

Python and TypeScript side by side

The same program in Python and in TypeScript, from the lessons of this course.

  1. Run TypeScript

    Python annotations are optional metadata for external checkers. TypeScript also erases types, but this course runner checks and compiles TypeScript before Node executes it. Braces and semicolons replace Python indentation-based blocks. Read the supplied typed…

    Python
    1name: str = "Ada"2print(f"Hello, {name}!")
    TypeScript
    1const name: string = "Ada";2console.log(`Hello, ${name}!`);
  2. Numbers and Conversion

    Python int and float conversion raise ValueError for bad numeric strings. JavaScript Number returns NaN instead, and unexpectedly converts blank text to zero. Validate blankness and finiteness explicitly. A TypeScript annotation does not perform conversion.…

    Python
    1print(int("12") + 3)
    TypeScript
    1const value: number = Number("12");2console.log(value + 3);
  3. Arrays and Slice

    Python slicing maps naturally to JavaScript slice, but a negative bracket index does not retrieve the last array element in JavaScript. Use at(-1) or an explicit length-based index. An out-of-range bracket read returns undefined instead of IndexError.…

    Python
    1import json2print(json.dumps([1, 2, 3, 4][1:-1], separators=(",", ":")))
    TypeScript
    1const values: number[] = [1, 2, 3, 4];2console.log(JSON.stringify(values.slice(1, -1)));
  4. For-of and Array Values

    Translate Python for value in values to JavaScript for (const value of values). JavaScript for-in is key enumeration, not Python iterable iteration. There is no built-in range syntax required here: for-of already supplies each element. JavaScript uses braces…

    Python
    1total = 02for value in [3, -1, 2]:3    if value > 0:4        total += value5print(total)
    TypeScript
    1let total: number = 0;2for (const value of [3, -1, 2]) { if (value > 0) total += value; }3console.log(total);
  5. Truthiness Is Not Emptiness

    Python empty lists and dictionaries are falsy, whereas JavaScript empty arrays and objects are truthy. The paired examples intentionally print different booleans. Test collection length explicitly when translating Python if values code. JavaScript conditions…

    Python
    1import json2print(json.dumps(bool([])))
    TypeScript
    1const value: unknown = [];2console.log(Boolean(value));
  6. Annotations and Inference

    Python separates arbitrary-precision int from float. TypeScript number uses JavaScript floating-point arithmetic for both whole and fractional values. BigInt is a separate runtime type outside these exercises; do not assume Python-sized integers are exact as…

    Python
    1price: float = 2.52count = 43print(format(price * count, "g"))
    TypeScript
    1const price: number = 2.5;2const count = 4;3console.log(price * count);

Syllabus

12 chapters48 lessons1 project48 challenges96 quiz questions

Start Here

1 lesson

Final Challenges

2 lessons

More courses for Python developers

Learn TypeScript from another language

Frequently asked questions

Who is TypeScript for Python Developers for?

For people who already write Python and want to learn TypeScript. Each lesson starts from Python you know and shows how TypeScript does the same thing, so you skip the beginner basics.

Do I need to know TypeScript already?

No. The course starts with your first TypeScript program. You need Python basics: variables, conditions, loops, functions and collections.

How many lessons does TypeScript for Python Developers have?

TypeScript for Python Developers contains 48 interactive lessons you can complete at your own pace.

What does TypeScript for Python Developers cover?

The course is organized into chapters covering: Start Here, Runtime Values, Runtime Collections, Runtime Control Flow, and more.

Is TypeScript for Python Developers free?

Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.

Coddy programming languages illustration

Start TypeScript for Python Developers for free

Get started