All notable changes to this project will be documented in this file.
- A
TypeVarbound to a generic class no longer produces an invalid TypeScript constraint. Generic interfaces declare defaults for their type parameters (T = unknown,T extends string = string), so out-of-scope references render as bare references (R extends Resource,data: R) instead of leaking the definition's parameter names or materializingunknown/stringfallbacks. - References to a generic interface always carry a valid type argument list, including bare references from non-generic classes and materialized pydantic/generic bases.
- Generic class fields keep their type parameters on Python 3.12.x, where
get_type_hintsresolves PEP 695 annotation strings to same-named module-levelTypeVars. Type parameter scoping matches by name, so fields likedata: Rare no longer emitted asunknown.
- Types in
TYPE_CHECKINGblocks are now correctly emitted in the generated TypeScript code isntead of raising an ValueError.
- Generic references in pydantic models no longer lose their type arguments when
the referenced model's type parameter shares a name with a parameter of the
enclosing generic class (e.g.
ResourceIdentifier[T_I]was emitted asResourceIdentifier<T>). TSBuilder.save_fileopens the target file in write mode, so saving generated TypeScript to disk no longer fails.
- Migrated the development environment and dependency management to uv.
- Enabled additional Ruff linting rules to improve code quality and consistency.
- Reformatted the codebase to comply with the updated Ruff configuration.
- Added support for generic types (TypeVars, bounded type parameters, parametrized references and generic inheritance), including pydantic generic models.
- Added configuration options for indentation style (tabs vs spaces) and size. Use
CONFIG.indent_with_tabsandCONFIG.indent_sizeto customize the output format of the generated TypeScript code.
- Add any_as_unknown config option to use
unknowninstead ofanyfor theAnytype from Python. This is now the default behavior #2.
- Support for edge cases in TypeScript interface generation, specifically when an interface has no elements but inherits from another type. This ensures that the generated TypeScript code is valid and does not produce empty interfaces.
- Support for excluding fields from TypeScript types using the
excludemethod. This only works forTSComplextypes, such asTSInterface,TSRecordType, andTSEnum. The builder also now supports excluding fields when adding types. - Added changelog :)
- Resolved a small issue with wrapped
dicttypes. - Fixed import error.
- Support for wrapper types, specifically
Mappedfrom sqlalchemy.
- Support for ABCs in inheritance.
- Minor issue with builder logic when using inherited types.
- Support for class inheritance in type generation.
datetimetype support.
- Ordering support for TypeScript generic types.
- Incorrect ordering logic for record types.
- TypeScript types are now consistently ordered by name.
fullstr()now ensures parent is always listed last.
- Example for Flask/Quart response typing.
- Initial support for
Recordtypes.
- Full support for recursive types.
- Enum support, including nested dicts.
- Basic conversion of Python primitives to TypeScript.
__hash__methods forRecordandSequencetypes.- TypeScript
exportkeyword support for cross-file usage. - Py.typed marker for PEP 561 compliance.
- Small builder class to simplify TypeScript generation.
- Badges, docs, and contribution guides.
- GitHub workflows, ReadTheDocs integration, and pre-commit hooks.
- Refactored base types into 3 categories.
- Renamed
converttogenerate.
- Compatibility fixes for Python 3.10.
- Hashing issue due to non-inherited methods.
- Inconsistent ordering behavior across Python versions.
- CI workflow issues with matrix and string casting.
Let me know if you'd like:
- This output as a
CHANGELOG.mdfile - GitHub diff links for each version
- A GitHub Action to generate this automatically with every tag push