Repository navigation
Conversation
TypeScript 7 no longer exposes the compiler API that dtsPlugin used to parse, transform and reprint each .d.ts. Parse with oxc-parser instead and splice each resolved path into the original text between the specifier's own quotes, so the rest of the declaration, quote style and comments included, is emitted as written. A syntax error in a declaration is now reported as a load error on that file, where the TypeScript parser recovered from it silently. resolveDependency returns a result instead of throwing, which removes the catch and its unreachable 'Unknown Error' branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gen-routes pulled FileRouteTypes['to'] out of apps/web's route tree with the TypeScript compiler API, which TypeScript 7 no longer exposes. Read it from oxc-parser's AST instead; the generated route.d.ts is byte-identical. A route tree that fails to parse, or whose union holds no string literal, now stops the script instead of being ignored or written out as an empty type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Removes the last first-party uses of the TypeScript compiler API, which TypeScript 7 (the native Go compiler) no longer exposes.
runtime-bundler'sdtsPluginandtesting'sgen-routesscript now parse withoxc-parser, which knip already installs.Changes
importspecifiers in each served.d.tsby splicing the resolved relative path into the original text, where it used to reprint the file through the TypeScript printer. The rest of each emitted declaration is now byte-for-byte its source: quote style, comments, and the position of/// <reference>directives (the printer had moved the one inpsychojs@2023.1.3above a leading comment). Which imports get rewritten and resolved is unchanged: everyimportdeclaration, including those nested indeclare moduleblocks, but notexport … from..d.tswith a syntax error now fails the runtime build with an error on that file. Before, the TypeScript parser recovered silently and the printer emitted whatever it had parsed.gen-routesnow stops with an error whenapps/web/src/route-tree.tsfails to parse, or when itsFileRouteTypes['to']union holds no string literal. Before, it ignored the parse error, or wrote an emptyRouteTo.oxc-parser^0.150.0is pinned once in the catalog and referenced fromruntime-bundler(dependencies, since its bin parses at run time) andtesting. It resolves to the 0.150.0 copy knip already installs, so the lockfile gains no package.Decisions
resolveDependencynow returns{ issue, success: false } | { relativePath, success: true }, the shapevalidatePackageNamealready uses, where it used to throw. Parse errors now arrive inresult.errors, so this function was the only thing left to throw. Keeping thecatchwould have meant keeping the unreachable non-Errorbranch or adding anas Errorassertion. Every error message is unchanged.Notes
runtime/v1before and after the change. All 195 emitted files are present in both. Every non-declaration file is byte-identical. All 56.d.tsfiles have the same 47 import specifiers, collected from the whole tree with the TypeScript parser. Their TypeScript-printed text also matches once quote style is normalized, apart from thepsychojsdirective order noted above.testing/src/generated/route.d.tsis byte-identical before and after (43 routes). I temporarily editedroute-tree.tsto hit each failure case: a missing interface, a union with no string literal, and a syntax error. Each one stopsgen:routeswith a non-zero exit.vendor/,git grep -nE "from ['\"]typescript['\"]"now returns nothing.Adversarial review
Reviewed at commit c22106d. pnpm check: green.
Findings
parseResult.module.staticImports, which lists top-level imports, was rewritten, so a bare import inside adeclare module '…' { … }block was copied through unrewritten and unresolved with no error, where the TypeScript visitor rewrote and resolved it — Collect the specifiers by walking the AST with oxc'sVisitor(ImportDeclaration), or return a load error for an import inside aTSModuleDeclaration; add a test with a bare import insidedeclare module.Fixed
ImportDeclarationis now collected with oxc'sVisitor, nested ones included. A new test checks that a bare import insidedeclare moduleis rewritten.Attestation
I, Claude Opus 5.5, attest that the review block above reports the adversarial review as it ran on the commit named, with every finding it returned.
🤖 Generated with Claude Code