tspls

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: Apache-2.0

README

TypeScript 7

tspls

tspls is a compact, gopls-style command for one-shot TypeScript semantic queries. It calls the TypeScript-Go project and language-service packages directly in-process. It does not start an LSP server or daemon, use JSON-RPC, launch another tsgo, or create a persistent index.

Supported commands:

tspls definition path/to/file.ts:LINE:COLUMN
tspls references [-d|-declaration] path/to/file.ts:LINE:COLUMN
tspls call_hierarchy path/to/file.ts:LINE:COLUMN
tspls implementation path/to/file.ts:LINE:COLUMN
tspls check path/to/file.ts

Positions are 1-indexed lines and UTF-8 byte columns. The gopls-compatible path/to/file.ts:#OFFSET form uses a zero-indexed UTF-8 byte offset. Run tspls help or tspls help <command> for compact command help.

Definition prints its first result. References and implementations print one normalized, deduplicated, sorted span per line. Call hierarchy prints sorted caller, identifier, and callee lines. Check prints sorted error and warning diagnostics. Spans use FILE:LINE:COLUMN, FILE:LINE:COLUMN-ENDCOLUMN, or FILE:LINE:COLUMN-ENDLINE:ENDCOLUMN. Successful queries exit 0, including ordinary diagnostics and empty reference, implementation, or check results. CLI syntax errors exit 2. Runtime, file, project, cancellation, missing definition, and missing call-hierarchy results exit 1. Errors go only to stderr; result text goes only to stdout.

Each invocation treats cwd as the workspace. It recursively discovers every file named exactly tsconfig.json, opens all discovered projects and the target in one session update, and uses an inferred project when no config exists. Directory symlinks are not followed. These directory basenames are pruned: .git, node_modules, .yarn, .pnpm-store, .next, .nuxt, .turbo, .cache, bower_components, jspm_packages, coverage, dist, build, out, tmp, and temp. The resolved target must be a readable regular file lexically inside cwd.

Install from an upstream-compatible checkout:

git clone https://github.com/meoyawn/tspls
cd tspls
go install ./cmd/tspls

After a generated release tag exists, remote installation works without a local checkout:

go install github.com/meoyawn/tspls/cmd/tspls@latest

The development branch intentionally keeps module github.com/microsoft/typescript-go and existing upstream import paths. This minimizes merge conflicts with Microsoft. Configure and merge upstream with:

git remote add upstream https://github.com/microsoft/typescript-go.git
git fetch upstream
git merge upstream/main

Release tags point to disposable generated commits whose module and imports are mechanically rewritten to github.com/meoyawn/tspls; those commits are never merged into the development branch. Verify the current working tree:

./scripts/prepare-tspls-release.sh --dry-run

To create a reviewed local release commit and tag from committed HEAD, run ./scripts/prepare-tspls-release.sh --tag vX.Y.Z. Inspect the tag, then push it explicitly. The script never pushes branches, tags, or releases.

Not sure what this is? Read the announcement post!

Preview

A preview build is available on npm as @typescript/native-preview.

npm install @typescript/native-preview
npx tsgo # Use this as you would tsc.

For TypeScript 7.0 RC and later, the command name is tsc.

A preview VS Code extension is available on the VS Code marketplace.

To use this, set this in your VS Code settings:

{
    "js/ts.experimental.useTsgo": true
}

What Works So Far?

This is still a work in progress and is not yet at full feature parity with TypeScript. Bugs may exist. Please check this list carefully before logging a new issue or assuming an intentional change.

Feature Status Notes
Program creation done Same files and module resolution as TS 6.0. Not all resolution modes supported yet.
Parsing/scanning done Exact same syntax errors as TS 6.0
Commandline and tsconfig.json parsing done Done, though tsconfig errors may not be as helpful.
Type resolution done Same types as TS 6.0.
Type checking done Same errors, locations, and messages as TS 6.0. Types printback in errors may display differently.
JavaScript-specific inference and JSDoc done Complete, but intentionally lacking some features. Declaration emit differs greatly, intentionally, to be closer to TS declarations.
JSX done -
Declaration emit done -
Emit (JS output) done -
Watch mode done -
Build mode / project references done -
Incremental build done -
Language service (LSP) in progress Nearly all features implemented.
API not ready -

Definitions:

  • done aka "believed done": We're not currently aware of any deficits or major work left to do. OK to log bugs
  • in progress: currently being worked on; some features may work and some might not. OK to log panics, but nothing else please
  • prototype: proof-of-concept only; do not log bugs
  • not ready: either haven't even started yet, or far enough from ready that you shouldn't bother messing with it yet

Other Notes

Long-term, we expect that this repo and its contents will be merged into microsoft/TypeScript. As a result, the repo and issue tracker for typescript-go will eventually be closed, so treat discussions/issues accordingly.

For a list of intentional changes with respect to TypeScript 6.0, see CHANGES.md.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit Contributor License Agreements.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Directories

Path Synopsis
cmd
tsgo command
tspls command
internal
api
ast
bundled
Package bundled provides access to files bundled with TypeScript.
Package bundled provides access to files bundled with TypeScript.
compiler
Package compiler implements the TypeScript compiler.
Package compiler implements the TypeScript compiler.
diagnostics
Package diagnostics contains generated localizable diagnostic messages.
Package diagnostics contains generated localizable diagnostic messages.
jsnum
Package jsnum provides JS-like number handling.
Package jsnum provides JS-like number handling.
jsonrpc
Package jsonrpc provides generic JSON-RPC 2.0 types and utilities that can be shared between LSP and other JSON-RPC based protocols.
Package jsonrpc provides generic JSON-RPC 2.0 types and utilities that can be shared between LSP and other JSON-RPC based protocols.
ls
lsp
lsp/lspwatcher
Package lspwatcher implements an in-process file watcher used as a drop-in replacement for LSP-based file watching when the client does not support dynamic registration of file watchers.
Package lspwatcher implements an in-process file watcher used as a drop-in replacement for LSP-based file watching when the client does not support dynamic registration of file watchers.
nodebuilder
Exports interfaces and types defining the node builder - concrete implementations are on top of the checker, but these types and interfaces are used by the emit resolver in the printer
Exports interfaces and types defining the node builder - concrete implementations are on top of the checker, but these types and interfaces are used by the emit resolver in the printer
printer
Package printer exports a Printer for pretty-printing TS ASTs and writer interfaces and implementations for using them Intended ultimate usage:
Package printer exports a Printer for pretty-printing TS ASTs and writer interfaces and implementations for using them Intended ultimate usage:
pseudochecker
pseudochecker is a limited "checker" that returns pseudo-"types" of expressions - mostly those which trivially have type nodes
pseudochecker is a limited "checker" that returns pseudo-"types" of expressions - mostly those which trivially have type nodes
stringutil
Package stringutil Exports common rune utilities for parsing and emitting javascript
Package stringutil Exports common rune utilities for parsing and emitting javascript
testutil/race
Package israce reports if the Go race detector is enabled.
Package israce reports if the Go race detector is enabled.
transpile
Package transpile implements single-file JavaScript and declaration emit.
Package transpile implements single-file JavaScript and declaration emit.
vfs
vfs/trackingvfs
Package trackingvfs provides a VFS wrapper that records every file path accessed during compilation.
Package trackingvfs provides a VFS wrapper that records every file path accessed during compilation.
scripts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL