🌐
GitHub
github.com › TheLartians › TypeScript2Python
GitHub - TheLartians/TypeScript2Python: 🚃 Transpile TypeScript types to Python! A TypeScript to Python type transpiler.
🚃 Transpile TypeScript types to Python! A TypeScript to Python type transpiler. - TheLartians/TypeScript2Python
Starred by 27 users
Forked by 3 users
Languages   TypeScript 91.3% | JavaScript 8.7%
🌐
GitHub
github.com › marcj › pybridge
GitHub - marcj/pybridge: TypeScript library to access python functions in NodeJS, type-safe and easy to use. · GitHub
TypeScript library to access python functions in NodeJS, type-safe and easy to use. - marcj/pybridge
Starred by 82 users
Forked by 10 users
Languages   TypeScript 98.1% | Python 1.9%
Discussions

Are there any tools to transform a large Typescript project into Python? Maybe a transpiler or something?
There are at least two big issues with this: Semantics: Javascript and Python are similar, being dynamic, garbage collected languages. But there is an incredible amount of subtlety to the way both languages behave. You'd end up needing to write your own runtime library to emulate javascript, which is known for many weird quirks. Maybe you could accomplish in a way where the resulting code is readable, but everything would still rely on your support library which provides non-standard behaviors for everything. Libraries: Both languages are known for their rich ecosystems. What libraries does your project use? Maybe you could compile the libraries as well, but what if they're native bindings? At minimum, you'd almost certainly need to provide some emulation for node/deno/bun/whatever runtime you're using. More on reddit.com
🌐 r/Compilers
6
0
May 29, 2025
Python equivalent of Typescript interface - Stack Overflow
For the code completion and type hinting in IDEs, just add static typing for the Person and Address classes and you are already good to go. Assuming you use the latest python3.6, here's a rough equivalent of the typescript classes from your example: More on stackoverflow.com
🌐 stackoverflow.com
Side project for converting Python into TypeScript
I definitely recommend you get rid of all of the any types that it outputs. Even if it is just meant as a placeholder, it’s actually worse than not having anything there, because Typescript won’t try to infer the types. In effect, it becomes just JavaScript with pointless Typescript syntax. More on reddit.com
🌐 r/typescript
43
106
December 26, 2020
Performance difference between Python and Typescript
I ran a benchmark deploying a Helm chart with Pulumi, using two languages: Python and Typescript. It seems that Typescript is quite a bit faster than the Python implementation. I just upped and des... More on github.com
🌐 github.com
3
February 10, 2021
🌐
GitHub
github.com › Madoshakalaka › python-typing-to-typescript
GitHub - Madoshakalaka/python-typing-to-typescript: convert python typing to interface · GitHub
The program parses Python script with Python's built-in ast, and uses typescript's compiler APIs to transform the ast nodes.
Author   Madoshakalaka
🌐
GitHub
github.com › cs-cordero › py-ts-interfaces
GitHub - cs-cordero/py-ts-interfaces: A Python to Typescript Interface Generator · GitHub
July 1, 2024 - Generally speaking, you can express any type that Python can do in TypeScript, but not vice versa. So defining the types in Python guarantee that you can also express the whole interface in both languages. Please note that usage of T U and V in the table below represent stand-ins for actual types. They do not represent actually using generic typed variables. ... The primary purpose of this library is to help type, first and foremost, data moving back and forth from client to server.
Starred by 111 users
Forked by 12 users
Languages   Python 99.1% | Shell 0.9%
🌐
GitHub
github.blog › home › news & insights › octoverse › typescript, python, and the ai feedback loop changing software development
TypeScript, Python, and the AI feedback loop changing software development - The GitHub Blog
November 13, 2025 - TypeScript passed Python. But the real story is why. Developers don’t usually switch languages just for philosophical reasons—they switch when something makes their work meaningfully faster, simpler, or less risky. And increasingly, what feels “easier” is tied to how well AI tools will support their work with that language.
🌐
Reddit
reddit.com › r/compilers › are there any tools to transform a large typescript project into python? maybe a transpiler or something?
r/Compilers on Reddit: Are there any tools to transform a large Typescript project into Python? Maybe a transpiler or something?
May 29, 2025 - It‘s everywhere in JS and almost nonexistant in Python. ... Your only chance is using LLMs. Good luck, hope you have a ton of unit tests. ... They became really good recently though. Deepsake from yesterday is even free ... I use a good amount of LLMs for carefully chosen tasks. I trust it about as much as a slightly experienced intern. I wouldn't trust an intern to port a typescript codebase to python.
Find elsewhere
🌐
GitHub
github.com › jecki › ts2python
GitHub - jecki/ts2python: Python-interoperability for Typescript-Interfaces · GitHub
June 19, 2014 - Python-interoperability for Typescript-Interfaces. Contribute to jecki/ts2python development by creating an account on GitHub.
Starred by 51 users
Forked by 5 users
Languages   Python
🌐
GitHub
github.com › topics › typescript-python
typescript-python · GitHub Topics · GitHub
To associate your repository with the typescript-python topic, visit your repo's landing page and select "manage topics."
Top answer
1 of 9
61

For the code completion and type hinting in IDEs, just add static typing for the Person and Address classes and you are already good to go. Assuming you use the latest python3.6, here's a rough equivalent of the typescript classes from your example:

Copy# spam.py
from typing import Optional, Sequence


class Address:
    street: str
    housenumber: int
    housenumber_postfix: Optional[str]

    def __init__(self, street: str, housenumber: int, 
                 housenumber_postfix: Optional[str] = None) -> None:
        self.street = street
        self.housenumber = housenumber
        self.housenumber_postfix = housenumber_postfix


class Person:
    name: str
    adresses: Sequence[Address]

    def __init__(self, name: str, adresses: Sequence[str]) -> None:
        self.name = name
        self.adresses = adresses


person = Person('Joe', [
    Address('Sesame', 1), 
    Address('Baker', 221, housenumber_postfix='b')
])  # type: Person

I suppose the boilerplate you mentioned emerges when adding the class constructors. This is indeed inavoidable. I would wish default constructors were generated at runtime when not declared explicitly, like this:

Copyclass Address:
    street: str
    housenumber: int
    housenumber_postfix: Optional[str]


class Person:
    name: str
    adresses: Sequence[Address]


if __name__ == '__main__':
    alice = Person('Alice', [Address('spam', 1, housenumber_postfix='eggs')])
    bob = Person('Bob', ())  # a tuple is also a sequence

but unfortunately you have to declare them manually.


Edit

As Michael0x2a pointed out in the comment, the need for default constructors is made avoidable in python3.7 which introduced a @dataclass decorator, so one can indeed declare:

Copy@dataclass
class Address:
    street: str
    housenumber: int
    housenumber_postfix: Optional[str]


@dataclass
class Person:
    name: str
    adresses: Sequence[Address]

and get the default impl of several methods, reducing the amount of boilerplate code. Check out PEP 557 for more details.


I guess you could see stub files that can be generated from your code, as some kind of interface files:

Copy$ stubgen spam  # stubgen tool is part of mypy package
Created out/spam.pyi

The generated stub file contains the typed signatures of all non-private classes and functions of the module without implementation:

Copy# Stubs for spam (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Optional, Sequence

class Address:
    street: str
    housenumber: int
    housenumber_postfix: Optional[str]
    def __init__(self, street: str, housenumber: int, housenumber_postfix: Optional[str]=...) -> None: ...

class Person:
    name: str
    adresses: Sequence[Address]
    def __init__(self, name: str, adresses: Sequence[str]) -> None: ...

person: Person

These stub files are also recognized by IDEs and if your original module is not statically typed, they will use the stub file for type hints and code completion.

2 of 9
24

A TypeScript interface describes a JavaScript object. Such an object is analogous to a Python dictionary with well-known string keys, which is described by a TypedDict.

TypeScript interface example

For example the TypeScript interface:

Copyinterface Address {
    street: string;
    housenumber: number;
}

will describe JavaScript objects like:

Copyvar someAddress = {
    street: 'SW Gemini Dr.',
    housenumber: 9450,
};

Python TypedDict example

The equivalent Python TypedDict:

Copyfrom typing import TypedDict

class Address(TypedDict):
    street: str
    housenumber: int

will describe Python dictionaries like:

Copysome_address = {
    'street': 'SW Gemini Dr.',
    'housenumber': 9450,
}

# or equivalently:

some_address = dict(
    street='SW Gemini Dr.',
    housenumber=9450,
)

These dictionaries can be serialized to/from JSON trivially and will conform to the analogous TypeScript interface type.

Note: If you are using Python 2 or older versions of Python 3, you may need to use the older function-based syntax for TypedDict:

Copyfrom mypy_extensions import TypedDict

Address = TypedDict('Address', {
    'street': str,
    'housenumber': int,
})

Alternatives

There are other ways in Python to represent structures with named properties.

Data classes, available in Python 3.7, have read-write keys. However they cannot be serialized to/from JSON automatically.

Copyfrom dataclasses import dataclass

@dataclass
class Address:
    street: str
    housenumber: int

my_address = Address(
    street='SW Gemini Dr.',
    housenumber=9450,
)

Named tuples are cheap and have read-only keys. They also cannot be serialized to/from JSON automatically.

Copyfrom typing import NamedTuple

class Address(NamedTuple):
    street: str
    housenumber: int

my_address = Address(
    street='SW Gemini Dr.',
    housenumber=9450,
)

Simple namespaces, available in Python 3.3, are similar to data classes but are not very well known.

Copyfrom types import SimpleNamespace

class Address(SimpleNamespace):
    street: str
    housenumber: int

my_address = Address(
    street='SW Gemini Dr.',
    housenumber=9450,
)

attrs is a long-standing third-party library that is similar to data classes but with many more features. attrs is recognized by the mypy typechecker.

Copyimport attrs

@attr.s(auto_attribs=True)
class Address:
    street: str
    housenumber: int

my_address = Address(
    street='SW Gemini Dr.',
    housenumber=9450,
)
🌐
DEV Community
dev.to › themuneebh › i-have-built-an-api-using-typescript-python-and-go-so-you-dont-have-to-b2h
I have built an API using TypeScript, Python, and Go, so you don't have to. - DEV Community
May 2, 2024 - That's it, so which one are you going to use for your next project? ... Generalist turned Go full time a bunch of years ago. ... I would always choose Go as I find the syntax a culmination of best practices from other languages as well. But I do admit it is verbose for some cases. That's why I was excited about the language getting some generics programming. I created github.com/dolanor/rip just to avoid most of this boilerplate in REST API creation.
🌐
GitHub
github.com › Latios96 › py-typescript-generator
GitHub - Latios96/py-typescript-generator · GitHub
Note: Currently, only Python dataclasses are supported, but it's possible to extend this to other sources, like attrs classes or SqlAlchemy models. This project is heavily inspired by the typescript-generator project by Vojtěch Habarta, a TypeScript generator for Java classes.
Starred by 9 users
Forked by 2 users
Languages   Python
🌐
Reddit
reddit.com › r/typescript › side project for converting python into typescript
r/typescript on Reddit: Side project for converting Python into TypeScript
December 26, 2020 - You want to port a Python library. Lots of use cases for compilers. ... For more information you can check github or ask me. This project still have some sharp edges that I'll need deal with later ; ) https://github.com/YushchenkoAndrew/ts-doodle ... Nice, I wonder if you could somehow use the typescript language server to implement type inference by usage?
🌐
GitHub
github.com › topics › typescript
typescript · GitHub Topics · GitHub
TypeScript compiles (or transpiles) ... environment. It can be used to develop JavaScript for both client-side and server-side applications. ... All 281,909 TypeScript 229,696 JavaScript 18,010 Vue 6,502 HTML 4,985 CSS 3,057 Java 1,911 Svelte 1,665 Python 1,545 SCSS 1,279 C# ...
🌐
GitHub
github.com › pulumi › pulumi › issues › 6302
Performance difference between Python and Typescript · Issue #6302 · pulumi/pulumi
February 10, 2021 - I ran a benchmark deploying a Helm chart with Pulumi, using two languages: Python and Typescript. It seems that Typescript is quite a bit faster than the Python implementation. I just upped and destroyed a single Helm chart several times...
Author   ppawiggers
🌐
GitHub
github.com › w0rp › python-to-typescript
GitHub - w0rp/python-to-typescript: Python tools for generating TypeScript interfaces from Python types · GitHub
September 9, 2023 - Python tools for generating TypeScript interfaces from Python types - w0rp/python-to-typescript
Starred by 11 users
Forked by 5 users
Languages   Python 96.8% | Shell 3.2%
🌐
Medium
medium.com › analytics-vidhya › typescript-for-python-developers-a16e50a5acb2
TypeScript for Python Developers. A quick introduction to TypeScript for… | by Anton De Meester | Analytics Vidhya | Medium
August 28, 2020 - There is no real difference between someObject.key or someObject['key'], except that the TypeScript compiler might complain less with the second varation. You cannot use variables in the creation, as keys are taken as strings in the assignment. As metioned, referencing non-existing fields returns undefined. Functions work much like in Python, with some small differences.
🌐
Reddit
reddit.com › r/typescript › how to create a python api for a project based on typescript ?
r/typescript on Reddit: How to create a Python API for a project based on Typescript ?
March 13, 2022 -

Hey TS community on Reddit

I am looking for some help / guidance & would be grateful for any helpful advice

So there's a project that i came across that is written in mostly typescript. However, i want to use a flask/python based front-end for it, so i need to know how can i make an API / package in Python that can call/execute typescript code from the project ?

I am not sure if my technical vocabulary is entirely correct, but basically i am looking to integrate a Typescript project in a Python front-end; by making calls to Typescript commands / calls from Python.

Would appreciate any and all help in this regard !

EDIT : I am not very proficient in Javascript or Typescript