tree-sitter-typescript
TypeScript and TSX grammars for the tree-sitter incremental parsing framework.
Repository Health
Technical Analysis
tree-sitter-typescript provides two tree-sitter grammars — one for TypeScript and one for TSX — that let editors, linters, and static-analysis tools build and incrementally update a concrete syntax tree for TypeScript source files. Because TSX is a genuinely distinct dialect (JSX syntax mixed with TypeScript types), the package ships it as a separate grammar rather than trying to overload a single parser for both.
The grammar is distributed as native bindings for Rust, Node.js, Python, Go, Swift, and C/CMake consumers, so the same underlying parser (generated from grammar.js and compiled C parser tables) can be embedded in editors like Neovim and Helix, in language-server tooling, or in any application that needs a fast, error-tolerant TypeScript parse tree rather than a full type-checking compiler.
What You Get
- Two separate grammars —
typescriptandtsx— reflecting that TSX is a distinct dialect from plain TypeScript - Native bindings for Rust, Node.js, Python, Go, Swift, and C/CMake so the parser can be embedded in editors and tooling written in any of those languages
- Query files under
queries/for syntax highlighting and other tree-sitter-consuming features - Incremental, error-tolerant parsing suitable for live-editing scenarios rather than a batch compiler pass
- A CI-tested grammar kept in sync with the upstream tree-sitter grammar DSL and parser generator
Common Use Cases
- Powering TypeScript/TSX syntax highlighting in editors such as Neovim, Helix, and other tree-sitter-based editors
- Building structural code search, refactoring tools, or linters that need a real syntax tree rather than regex-based matching
- Embedding a TypeScript parser in a Rust, Python, or Node.js application via the language-specific bindings
- Implementing custom static-analysis or code-intelligence tooling that needs incremental re-parsing as a file is edited
Under The Hood
Architecture - The grammars are defined in typescript/grammar.js and tsx/grammar.js using tree-sitter’s grammar DSL, then compiled by the tree-sitter CLI into C parser tables checked into typescript/src and tsx/src. Per-language bindings live under bindings/ (c, rust, node, python, go, swift), each a thin wrapper that loads the compiled parser and exposes it through that language’s native API; queries/ holds tree-sitter query files consumed by editors for highlighting and other features.
Tech Stack - The grammar definitions are JavaScript, but the generated parsers are C (22.7% of the repo), with Rust bindings built via a build.rs script declared in Cargo.toml, Node bindings via binding.gyp, and equivalent packaging for Python (setup.py/pyproject.toml), Go (go.mod), and Swift (Package.swift) — a genuinely polyglot distribution model built around one shared C parser core.
Code Quality - CI (GitHub Actions) runs the grammar’s test corpus on every change; the project has a low but steady maintenance cadence (739 total commits since 2017, most recent release in November 2024) reflecting that TypeScript/TSX grammar changes are infrequent once a language’s syntax stabilizes, though this also means newer TypeScript syntax may lag behind the latest release.
API Design - Consumers require two distinct exports — require('tree-sitter-typescript').typescript and .tsx — which is a deliberate, low-boilerplate way of surfacing that TSX is not simply ‘TypeScript inside a JSX file.’ Each language binding follows that host language’s idiomatic parser API (e.g. tree_sitter::Language in Rust), so developers already familiar with tree-sitter in one language transfer that knowledge easily to another.
Used by 12 apps in this directory
Claude Context
AI Code Assistants · Mcp
An MCP server and VS Code extension by Zilliz that turns your entire codebase into semantically searchable context for Claude Code, Cursor, and Gemini CLI, using vector embeddings and Merkle-tree change detection.
claude-mem
AI Agents · AI Development · AI Memory
Give your AI coding agents persistent memory — claude-mem captures everything that happens during sessions, compresses it with AI, and surfaces the right context in every future session automatically.
cocoindex
AI Development · Data Engineering
An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.
codegraph
AI Code Assistants · Developer Tools
A pre-indexed code knowledge graph that cuts AI tool calls by 58% and token costs by 16% — auto-syncing, 100% local, works with Claude Code, Cursor, Codex, and more.
Fresh
Code Editors · Developer Tools
A zero-configuration terminal text editor with familiar keybindings, full mouse support, LSP-powered IDE features, and a built-in orchestrator for running multiple coding agents in parallel worktrees.
GitNexus
AI Code Assistants · Developer Tools · Mcp
Index any codebase into an interactive knowledge graph and give your AI agents deep architectural context via MCP — with zero servers required.
Graphify
AI Agents
A YC-backed, open-source knowledge graph skill for AI coding assistants — type /graphify and it maps your entire project (code, docs, PDFs, images, videos) into a queryable graph instead of grepping through files.
OpenViking
AI Development · AI Memory · Databases
An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.
Tabby
AI Code Assistants
Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.