Repository navigation
fix(typescript-plugin): apply tsc patches under Deno - #133
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
This was referenced Sep 25, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running
tsrx-tscunder Deno reports TS2307 for.tsrximports because Deno's CommonJS loader bypasses thefs.readFileSynchook that Volar uses to patch TypeScript's CLI.Add a
node:module.registerHooksload hook for the resolved TypeScript CLI entry. It reads through Volar's patched reader and deregisters before loading the consumer compiler and its dependencies. Older Node versions withoutregisterHooksretain the existing loading behavior, so no minimum Node version increase is needed.Add regression coverage for normal loading, loading that bypasses the filesystem hook, and the older Node fallback. The tests check imports, diagnostics, TypeScript version reporting, and hook cleanup. Include Deno task documentation and a patch changeset.
Fixes #128.
Validation:
pnpm test --project typescript-plugin— 178 tests passed.pnpm exec tsgo --noEmit -p packages/typescript-plugin/tsconfig.typecheck.json.git diff --check, andpnpm changeset:check.pnpm --filter @tsrx/typescript-plugin build..tsrxfiles and their TypeScript consumers are reported correctly under Node 22.14.0, 22.23.2, 24.18.0, 26.9.0, and Deno 2.9.6.Note
Low Risk
Scoped to the
tsrx-tscCLI entry load path with deregistration and multi-loader tests; no change to editor/tsserver behavior beyond the same Volar patch applying in Deno.Overview
Fixes
tsrx-tscunder Deno (and similar loaders) where TypeScript’s CLI was loaded without Volar’s patch, causing TS2307 on.tsrximports.The CLI now optionally registers a
node:moduleloadhook for the resolvedtypescript/lib/tsc.jsURL so that entry is read while Volar’sfs.readFileSyncpatch still applies; the hook deregisters right after that load (and in afinallyblock) so later compiler resolution uses normal loading. Node withoutregisterHookskeeps the previous behavior.Adds Vitest coverage for native, Deno-like bypass, and legacy (no hooks) loaders—
.tsrxresolution, diagnostics,--version, and hook/fs cleanup. README documentstsrx-tscand a Deno 2.8+deno task checkexample without a custom loader.Reviewed by Cursor Bugbot for commit cc892a4. Bugbot is set up for automated code reviews on this repo. Configure here.