pydantic-to-typescript
Convert pydantic models to typescript interfaces
Decision gist · record as of 2026-08-14
Yes, if you have a Python backend with pydantic models and a TypeScript frontend that needs to stay in sync. The package solves a real problem—type definition drift—with minimal overhead. Install friction is low and the MIT license is unrestricted. The main caveat is dormant maintenance (last release 630 days ago), so if you rely on cutting-edge pydantic features or need active support, evaluate whether the tool handles your specific model patterns before committing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires json2ts CLI utility (npm package json-schema-to-typescript) to be installed and accessible on the system PATH or specified via --json2ts-cmd flag.
- Low friction install with a single runtime dependency (pydantic).
- Maintenance is dormant—last commit was 2024-11-22 and no release in 630 days—but the package is marked Production/Stable and carries 432 GitHub stars, suggesting it remains functional for its narrow use case.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or proprietary projects.
last release 2024-11-22 (630 days) · last repo commit 2024-11-22 · 432 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 863,682 downloads/mo, #4,867 on PyPI
Alternatives
Verify before relying
pip install pydantic-to-typescript
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
# Then run: pydantic2ts --module mymodule --output ./types.ts- Whether the package handles complex pydantic features (validators, computed fields, discriminated unions) correctly in TypeScript output.
- Performance characteristics when converting large numbers of models or deeply nested model hierarchies.
- Compatibility with recent pydantic v2 field definitions and serialization modes beyond basic type mapping.
What it is and what it does
pydantic-to-typescript is a CLI tool that reads pydantic model definitions from a Python module and generates corresponding TypeScript interface definitions. It bridges the gap between Python and JavaScript type systems by allowing teams to maintain a single authoritative source of type definitions in Python, then automatically generate matching TypeScript interfaces for frontend consumption. The tool depends on pydantic for model introspection and json2ts for the actual TypeScript generation.
The package is designed for full-stack applications where Python backends serve APIs consumed by TypeScript/JavaScript frontends. Instead of manually keeping type definitions in sync across languages, you define your data models once in pydantic and run the tool to generate TypeScript interfaces that match exactly. The generated interfaces are marked as auto-generated to discourage manual edits, reinforcing the single-source-of-truth pattern.
Use it for
- Generate TypeScript types for a backend's request/response models to keep frontend and backend type definitions synchronized.
- Exclude sensitive or internal pydantic models from TypeScript output using the --exclude flag when only a subset of models should be exposed.
- Integrate into a build pipeline to regenerate TypeScript definitions whenever pydantic models change, ensuring frontend types never drift from backend reality.
- Convert a Python module with multiple interdependent pydantic models into a single TypeScript definitions file for import across a frontend codebase.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have a Python backend with pydantic models and a TypeScript frontend that needs to stay in sync.
The package solves a real problem—type definition drift—with minimal overhead. Install friction is low and the MIT license is unrestricted. The main caveat is dormant maintenance (last release 630 days ago), so if you rely on cutting-edge pydantic features or need active support, evaluate whether the tool handles your specific model patterns before committing.
Install
pydantic-to-typescript on PyPI
Before you install
Low friction install with a single runtime dependency (pydantic). Maintenance is dormant—last commit was 2024-11-22 and no release in 630 days—but the package is marked Production/Stable and carries 432 GitHub stars, suggesting it remains functional for its narrow use case.
Requires json2ts CLI utility (npm package json-schema-to-typescript) to be installed and accessible on the system PATH or specified via --json2ts-cmd flag.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or proprietary projects.
Quickstart
pip install pydantic-to-typescript
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
# Then run: pydantic2ts --module mymodule --output ./types.ts
Verify before relying
- Whether the package handles complex pydantic features (validators, computed fields, discriminated unions) correctly in TypeScript output.
- Performance characteristics when converting large numbers of models or deeply nested model hierarchies.
- Compatibility with recent pydantic v2 field definitions and serialization modes beyond basic type mapping.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepydantic |
| Maintenance | Dormant 630 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 863,682 / month, #4,867 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: pydantic_to_typescript-2.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “generate typescript from python models”
- pydantic-to-typescriptConverts pydantic model definitions into TypeScript interface…
- pydantic-to-typescript2Converts Pydantic models to TypeScript interfaces via a CLI tool,…
- django-typomaticGenerates TypeScript interfaces and enums from Django Rest Framework…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also pydantic-to-typescript2 · sparkdantic · fastui · jsonschema-pydantic-converter · pydantic-factories · pydantic-to-pyarrow · pydantic-numpy · flask-pydantic-spec · pylint-pydantic · pydantic-handlebars