Skip to content

grammar(ts): vendor our tree-sitter-typescript fork (84ffdb8) - #16

Merged
inth3shadows merged 3 commits into
mainfrom
grammar/own-fork
Nov 6, 2026
Merged

inth3shadows merged 3 commits into
mainfrom
grammar/own-fork

Conversation

@inth3shadows

Copy link
Copy Markdown
Owner

What

Vendors the TypeScript grammar from our fork, inth3shadows/tree-sitter-typescript@84ffdb8 (private during burn-in). docs/grammars/tree-sitter-typescript.patch applied to marionebl 53071c9 reproduces the fork's common/ byte for byte, so the build stays reproducible from public sources.

New since #15, each landed in the fork under its own differential CI plus a node-by-node tree diff (only files with the targeted construct changed):

  • tagged templates with type arguments, sql<{ id: number }>`SELECT ...` : a call_expression branch under the generic call's precedence with required type arguments
  • unique as a name outside unique symbol
  • tuple labels named like type keywords ([symbol: string], [number?: string], upstream fix: center docs content on wide screens colbymchenry/codegraph#378)

Differential

corpus #15 this PR
effect 29 3
zod 0 0
excalidraw 0 0
vscode 3 0
total 32 3

new 0, worse 0; local 45 fixtures (5 gap).

Tests

No EXTRACTION_VERSION bump (fork re-indexes manually).

The TypeScript grammar now comes from inth3shadows/tree-sitter-typescript
84ffdb8, our fork (marionebl 53071c9 + dokimasia's import-type commits +
our fixes), which runs the tsc differential as its own CI. It is private
during burn-in, so docs/grammars/tree-sitter-typescript.patch stays the
public, reproducible form: applied to marionebl 53071c9 it gives the
fork's common/ byte for byte.

New since PR #15, each gated in the fork and diffed node by node:
tagged templates with type arguments (sql<Row>`...`), `unique` as a
name, and tuple labels named like type keywords (upstream colbymchenry#378).
Differential here: 32 -> 3 (effect 29 -> 3, vscode 3 -> 0), new 0,
worse 0. Adds the fork's three tsc fixtures (ts + tsx).
Round-1 review of #16 found two regressions from the fork's new rules,
fixed in the fork (fa2be11, its PR #7):

- keyword tuple labels made `[type]`, `[get, set]`, `[declare?]` fail;
  labels are now only words that already lex as keywords where a type
  starts;
- `unique` as a reserved identifier broke `f<typeof unique>(x)`; backed
  out, so `i < unique.length` is a gap fixture again (VS Code's 2 files
  diverge, as on em.34).

New __tests__/typescript-grammar-fork-shapes.test.ts pins the node shapes
and the call edges (sql<Row>`...`, behind await, on a member; tuple labels;
typeof unique): 4 failed on 84ffdb8, 8 passed on fa2be11.

Docs: an operator before a typed tag (shared with generic calls), the
unique gap, `in?:`/`in<T>()` members, the Json5 line, a tag with 2+ type
args inside an argument list; the rebuild runs `tree-sitter test`; the
move checklist lists every vendored file, the hashes, and the marker
caveat. The fork commit is named once, in the grammar doc.

Differential: 201 -> 5 (effect 3, vscode 2), worse 0.
…s only)

The fork's 1439129 changes comments only (generated parsers and wasm are
unchanged); the patch and the define-grammar.js hash follow it. Known
limits now say exactly which unique, tuple-label and in?/in<T>() forms
fail, and the shapes test pins the other typeof unique forms the round-1
regression broke.
@inth3shadows
inth3shadows merged commit a076624 into main Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant