Skip to main content

PyTSCheck

PyTSCheck logo: white PyTS lettering and checkmark on blue

Type-check TypeScript from Python, without installing Node.js or Go.

PyTSCheck wraps Microsoft's native TypeScript compiler, tsgo, and returns structured diagnostics for source strings, files, and projects. Platform wheels include the compiler and TypeScript standard-library declarations. The Python runtime has no third-party dependencies.

Documentation · Quick start · Python API · Publishing

Install

Requires Python 3.11 or later on a supported platform.

The current package version is 0.1.0, an initial release. Once that version is published to PyPI:

python -m pip install --only-binary=:all: "pytscheck==0.1.0"

Before publication, install the wheel for your operating system and Python architecture from a successful Build PyPI distributions Actions run:

python -m pip install /path/to/pytscheck-platform-wheel.whl
python -m pytscheck --version

Replace the example path with the actual downloaded .whl filename. See installation for Windows, offline installation, and source checkouts.

Check TypeScript

from pytscheck import check

result = check('export const age: number = "twenty";')
assert not result.success
assert result.errors[0].code == 2322

for error in result.errors:
    print(error.file, error.line, error.column, error.message)

Type errors return a Result. Missing compilers, invalid configuration, timeouts, and other operational failures raise exceptions.

from pytscheck import CompilerOptions, check_file, check_project

file_result = check_file("src/app.ts")
project_result = check_project(
    ".",
    options=CompilerOptions(target="es2022", module="nodenext"),
)

Project checking uses the root tsconfig.json when present. Without one, it checks discovered .ts, .tsx, .mts, and .cts files, excluding node_modules. The defaults enable strict checking and disable emission. See configuration for option precedence and project limitations.

JavaScript and JSDoc

Check JSDoc-typed JavaScript using a project tsconfig with allowJs, checkJs, and noEmit enabled, then run pytscheck project .. Strings and individual .js files can also be checked through CompilerOptions(extra={"allowJs": True, "checkJs": True}).

See the JSDoc guide and examples/check_jsdoc.py for working examples.

Command line

python -m pytscheck string 'export const x: number = 1;'
python -m pytscheck file src/app.ts --json
python -m pytscheck project .
python -m pytscheck --where

The installed pytscheck command accepts the same arguments. Exit codes are 0 for success, 1 for compiler errors, 2 for usage/configuration errors, and 3 for operational failures. See the CLI guide.

Integrate generated TypeScript

An adapter can provide generated TypeScript through SourceFile objects:

from pytscheck import SourceFile, check_project

class GeneratedAdapter:
    name = "example-generated"
    protocol_version = "1.0"

    def get_sources(self, project_root: str) -> list[SourceFile]:
        return [SourceFile(path="generated.ts", text="export const x: number = 1;")]

result = check_project(".", adapter=GeneratedAdapter())
assert result.success

Adapters live in consuming packages; core does not ship framework integrations. Source-map v3 positions can be translated back to original files. Optional ProjectContext adds inherited settings, real-project imports, and declarations bundled in Python packages. Read the adapter guide before integrating a component compiler.

Scope and compatibility

  • Python 3.11, 3.12, and 3.13 are exercised in CI.
  • Six wheels cover Linux, Windows, and macOS on x64 and ARM64. Linux wheels target glibc 2.17+; macOS wheels require macOS 12+.
  • The bundled compiler is pinned to 7.0.0-dev.20260707.2. Its TypeScript behavior may differ from another tsc or tsgo version.
  • Checks run locally. Installing a wheel requires no compiler download at check time; building from source can download the pinned binary.
  • This is a checker API, not a JavaScript bundler, language server, or incremental build service. Project references are not automatically built with tsgo -b.

See compatibility, security, and troubleshooting.

Development and verification

git clone https://github.com/aldanedev-create/pytscheck.git
cd pytscheck
python -m venv .venv
# Activate .venv for your shell, then:
python -m pip install -e ".[dev]"
python scripts/build_binaries.py linux-x64
python -m pytest tests
python conformance/run.py

Use your platform identifier instead of linux-x64. Run the suite serially; failure tests temporarily replace the compiler. Full setup and release checks are in development and testing.

License and contributions

PyTSCheck is licensed under Apache-2.0. Bundled upstream components retain their own licenses and notices. Read CONTRIBUTING.md to contribute and SECURITY.md to report vulnerabilities.

Metadata

Release files for pytscheck 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytscheck 0.1.0
File Size Uploaded
pytscheck-0.1.0.tar.gz 506.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pytscheck 0.1.0
File
pytscheck-0.1.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
pytscheck-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
pytscheck-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux musl 1.2+ x86-64 Details
pytscheck-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl Python 3 none Linux glibc 2.17+ ARMv7l, Linux musl 1.2+ ARMv7l Details
pytscheck-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64, Linux musl 1.2+ ARM64 Details
pytscheck-0.1.0-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details
pytscheck-0.1.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details

Total release size: 67.6 MB

Release files / pytscheck-0.1.0.tar.gz

Download URL pytscheck-0.1.0.tar.gz
Size 506.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cab354ac7e3c1d0817e941ced8b733144e0e6155ee63841e90da35c779108096
BLAKE2b-256 checksum
How to use checksums
64eaf1eb29a2ed28305e0e25c040c23f4809e76ee63014562590029de59a1a34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.1.0-py3-none-win_arm64.whl

Download URL pytscheck-0.1.0-py3-none-win_arm64.whl
Size 9.1 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
0fe2b724875a636afc2b291a2c1e7e84f15de4fce61d3c2b5ec296480f77ece5
BLAKE2b-256 checksum
How to use checksums
e88896234a62f259d86c68dd185167d797f3ec973f17be0766e7480508d87176
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.1.0-py3-none-win_amd64.whl

Download URL pytscheck-0.1.0-py3-none-win_amd64.whl
Size 10.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d927f771c6ffd3c026c337088fee3acc43693f8369c11e17d00e67a5105acd49
BLAKE2b-256 checksum
How to use checksums
1944472dae7631dc491591d5d3bcde709dbf88c82a2077a66a3f418083a0cd67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl

Download URL pytscheck-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl
Size 9.9 MB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
f9e8754800e62c5602d3cb39692e04de2da0bb47172c17ae5bea664545b23ac5
BLAKE2b-256 checksum
How to use checksums
400a375c43fe0bd4b66fc25270d8e634171fa2c60c9cf209d97288975ea718fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl

Download URL pytscheck-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl
Size 9.3 MB
Tags Linux glibc 2.17+ ARMv7l Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
1f0587ccd99a25ce691ac62f7b65191bbf4062718141de21406da87a6160294e
BLAKE2b-256 checksum
How to use checksums
6847977b163e533c91b0bfda7a17e260963791c3eb7358ed23d9112341c5461c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl

Download URL pytscheck-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl
Size 9.1 MB
Tags Linux glibc 2.17+ ARM64 Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
0f1491c44632d7ddc3ce01692b78ec50b936bbbe7fd60d587b2ae5bee27740ae
BLAKE2b-256 checksum
How to use checksums
229f59adfe3ad31f19b6c541117315806b1730d7deda33c24eb85ee77046bb83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.1.0-py3-none-macosx_12_0_x86_64.whl

Download URL pytscheck-0.1.0-py3-none-macosx_12_0_x86_64.whl
Size 10.3 MB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
db95442980e60260d9c6c17efbacdd7be4e420d5bedf0f7a0e5904740def4bf6
BLAKE2b-256 checksum
How to use checksums
1073111ea49dd03c4b0a9f184e8e1c603f3de31c2899864a9a0e987668c8c0f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pytscheck-0.1.0-py3-none-macosx_12_0_arm64.whl

Download URL pytscheck-0.1.0-py3-none-macosx_12_0_arm64.whl
Size 9.5 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
930b82b3d8cf585443dc35e00f58096fdff5d00ac9528046f34a4a0b2b1e4655
BLAKE2b-256 checksum
How to use checksums
0e4330fdb0fb9a78caff6a879a1b6e59da5a29aeaf4aaaedb027ea8048dad5ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

0.1.1

8 release files

This release

0.1.0 This release

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page