Repository navigation
fix(module): normalize type root candidates to stop a panic with project references - #999
Merged
camc314 merged 1 commit intoNov 16, 2026
Conversation
…ect references Port Go `getCandidateFromTypeRoot` (`resolver.go:659`): build the candidate with `resolve_path_for_module`, the port of `resolutionCandidateFromDirectoryPath`. `combine_paths` kept the `..` segments of a relative name such as `../../node_modules/foo/index.d.ts`. With project references and `use_source_of_project_reference` (tsrs-lint), the dts faking host received the unnormalized path. If the path was under a symlinked package, `resolve_file_name` could not trim the recorded symlink prefix, and its `expect` panicked. `tsrs -p` did not panic, but its resolution trace printed `<type root>/../pkg.d.ts` where tsgo prints `<dir>/pkg.d.ts`.
magurotuna
marked this pull request as ready for review
November 16, 2026 07:57
Contributor
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
camc314
approved these changes
Nov 16, 2026
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.
tsrs-lint panicked with "canonical symlink path did not match its presentation path" (
projectreferencedtsfakinghost.rs). It happens when the program has project references and a relative type reference goes from a type root into a symlinked package (pnpm). vuejs/router has this layout: the code that Vue generates for.vuefiles has such references (generateGlobalTypesReference). This plain TypeScript project reproduces it:In
app/,OXLINT_TSGOLINT_PATH=<tsrs-lint> oxlint --type-aware .panics. The lookup in the type rootnode_modules/@typesmakes the candidateapp/node_modules/@types/../../node_modules/foo/index.d.ts. This path does not start with the symlink path that the dts faking host records fornode_modules/foo, so theexpectfails.typeroot_candidate_testbuilds the same project in memory.get_candidate_from_type_rootdid not normalize the candidate, so it kept the..segments. GogetCandidateFromTypeRootnormalizes it withresolutionCandidateFromDirectoryPath, and tsrs now uses its port,resolve_path_for_module. This also fixes the--traceResolutionoutput oftsrs -p(<dir>/types/../pkg.d.tsbecomes<dir>/pkg.d.ts, as in tsgo) and thetypeRootsfallback of module resolution (resolveFromTypeRoot). Theexpectstays, because Go panics on the same condition.