Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

ANTLR is blocking the TypeScript upgrade #478

In progress

Description

@mr-zwets

Problem

#407 (TypeScript 6 upgrade) is blocked on a new antlr4 release, and that release may not come.

Why upgrade TypeScript at all

This is a maintenance upgrade. Consumers are unaffected by which TypeScript version we compile with, and build speed is not a factor (type-checking takes under a second per package). The reasons are:

  • our current moduleResolution: "node" is deprecated in TypeScript 6 and removed in TypeScript 7, which is now the default npm install;
  • our examples and templates should work with current TypeScript;
  • delaying makes the migration larger.

Is ANTLR still maintained, and what does that mean for us

ANTLR 4 looks dormant rather than actively maintained:

For us this is a slow risk, not an urgent one. Our grammar changes rarely and the runtime itself is stable and works. What we lose is the ability to get fixes: typings problems, security reports and future TypeScript incompatibilities will have to be worked around on our side. We should stop treating "wait for upstream" as a plan.

The active TypeScript work has moved to the antlr-ng project (antlr4ng runtime). It is largely a single-maintainer effort, so it is a more active dependency but not obviously a safer one.

What breaks today

  • For us: with moduleResolution: "nodenext", the antlr4 typings fail to resolve their own directory imports, giving TS2305: Module '"antlr4"' has no exported member 'ErrorListener' (also ParseTreeVisitor, ParserRuleContext, TerminalNode, ATN). skipLibCheck does not help. Same on TS 6.0.3 and 7.0.2.
  • For consumers: projects using nodenext with skipLibCheck: false get 70 type errors from antlr4's typings via cashc's public types. This happens on TS 5.9 too and is not fixed by upgrading our compiler.

Options

  1. Use moduleResolution: "bundler" and keep antlr4@4.13.2. Works on TS 6 and 7 in a minimal repro. Downsides: no compiler enforcement of .js extensions on relative imports, and it does not fix the consumer problem.
  2. Patch the antlr4 typings (yarn patch / patch-package) with the upstream fix. Upstream dev still has a broken ../state.js import, so it only passes with skipLibCheck: true. A local patch does not reach consumers.
  3. Migrate to antlr4ng. Compiles cleanly under nodenext on TS 6 and 7 with full lib checking, and would fix the consumer problem. Requires regenerating the parser and adapting AstBuilder, the error listeners and Location to API differences.
  4. Wait for upstream. No timeline.

Proposal

Do option 1 now to unblock #407, and use this issue to evaluate option 3 as the longer-term path.


Commit counts are from the GitHub API as of 2026-11-29. The repro results are from a scratch project, not from the #407 branch.

Activity

  1. linked a pull request that will close this issueUpdate to TypeScript v6 #407on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions