PyTSCheck
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 anothertscortsgoversion. - 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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytscheck-0.1.1.tar.gz | 507.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pytscheck-0.1.1-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details |
| pytscheck-0.1.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| pytscheck-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl | Python 3 | none | Linux musl 1.2+ x86-64, Linux glibc 2.17+ x86-64 | Details |
| pytscheck-0.1.1-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.1-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.1-py3-none-macosx_12_0_x86_64.whl | Python 3 | none | macOS 12.0+ x86-64 | Details |
| pytscheck-0.1.1-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.1.tar.gz
| Download URL | pytscheck-0.1.1.tar.gz |
|---|---|
| Size | 507.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c0bf2cfc0ecb9152dfd17aa50c3e32a0c478146391c85f557a30f4d9c180b18
|
|
BLAKE2b-256 checksum How to use checksums |
a7120b32eaab6b181b37359f11106c99bc84113573f1b2a1b0781ed531e6f684
|
| 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.1-py3-none-win_arm64.whl
| Download URL | pytscheck-0.1.1-py3-none-win_arm64.whl |
|---|---|
| Size | 9.1 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
c97aded1a99e705b43d7912069215b5fa80d5cf54067f0ce7202e3d358d566ae
|
|
BLAKE2b-256 checksum How to use checksums |
24bba925e5b31e192c38684b219407afef3651b6fbf70ff0d81cd8727b8a2d8c
|
| 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.1-py3-none-win_amd64.whl
| Download URL | pytscheck-0.1.1-py3-none-win_amd64.whl |
|---|---|
| Size | 10.0 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
64592d0bb8306831ade63c931739a5cb55a88b85ab1ead36ecbf4d2316d750fc
|
|
BLAKE2b-256 checksum How to use checksums |
c75b6a011ca81c499c93630afb093e3be6837650afe012424408d44f97eee3eb
|
| 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.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl
| Download URL | pytscheck-0.1.1-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 |
c75c952140d09a4c2e619313272d04ad62eb5790049ff4c70e78235a1afd4e1b
|
|
BLAKE2b-256 checksum How to use checksums |
c4a632f323a0c23de3bb1dd40dcabcf0600c11547ed14d28d412e1535db8cf4c
|
| 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.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_2_armv7l.whl
| Download URL | pytscheck-0.1.1-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 |
042e71ca49c972d1099cb50f6186c9d1a73f202176fee52459c27df9fd80a5c7
|
|
BLAKE2b-256 checksum How to use checksums |
3ccaf47a0ba7cd017f0721711a57b18c4a6acb9b3e497eb6f2c83b131008c66b
|
| 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.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl
| Download URL | pytscheck-0.1.1-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 |
e515be1b7b86833b3612a61d1da3598015bb99cd92a7b43364cabf215d386267
|
|
BLAKE2b-256 checksum How to use checksums |
f1c5281133991a0c454072c30d920b7c8f8e6cfc6ccee960d17dc0d279f59fff
|
| 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.1-py3-none-macosx_12_0_x86_64.whl
| Download URL | pytscheck-0.1.1-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 |
979e3dafb1a52c1c8a5d3119415653937178f2c0bd14abd02efa45a74c41d1f5
|
|
BLAKE2b-256 checksum How to use checksums |
3b3a777d50d31fd766875da5e17f98eb9acff831718d04426df8b1c4eca5b9c0
|
| 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.1-py3-none-macosx_12_0_arm64.whl
| Download URL | pytscheck-0.1.1-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 |
f7fb23deca95485635d35f5cf226ec31272e1c049d5e73072f9df7a9e4a4d2ca
|
|
BLAKE2b-256 checksum How to use checksums |
47e0cef58d20e8beb8da2fabc5d689a0404fb19f01458ea2958a47097657ea36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|