Skip to content

[api] Resolution utility APIs - #65591

Open
Andrew Branch (andrewbranch) wants to merge 3 commits into
microsoft:mainfrom
andrewbranch:resolution-utility-apis
Open

Andrew Branch (andrewbranch) wants to merge 3 commits into
microsoft:mainfrom
andrewbranch:resolution-utility-apis

Conversation

@andrewbranch

Copy link
Copy Markdown
Member
  • API.getEffectiveTypeRoots
  • API.getTsBuildInfoEmitOutputFilePath
  • ModuleResolver.resolveTypeReferenceDirective

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Omitting containingFile can cause a panic, while the compiler-option utilities mishandle ${configDir} and empty config paths.

2 open issues
What changed in this PR

Exposes compiler resolution and output-path helpers through the Go-backed TypeScript API, with asynchronous, synchronous, and generator-based support.

Changes:

  • Add effective type-root and build-info output-path queries.
  • Expose type-reference directive resolution with resolution modes, traces, and snapshot support.
  • Extend protocol definitions and tests for validation, disposal, filesystem state, and generator parity.
File Description
tsc/​internal/​api/​session.go Dispatches new requests and implements path utility handlers.
tsc/​internal/​api/​session_module_resolution_test.go Tests invalid type-reference resolution requests.
tsc/​internal/​api/​proto.go Defines new protocol methods, parameters, and results.
tsc/​internal/​api/​module_resolution.go Adds type-reference resolution and shares resolver-context selection.
packages/​typescript/​test/​sync/​api.test.ts Adds generated synchronous utility and resolution tests.
packages/​typescript/​test/​sync/​api-generators.test.ts Checks generator parity for the new methods.
packages/​typescript/​test/​async/​api.test.ts Tests utilities, resolution modes, snapshots, and disposal.
packages/​typescript/​src/​api/​sync/​api.ts Adds generated synchronous methods and generator variants.
packages/​typescript/​src/​api/​proto.generated.ts Updates generated protocol types and batch method unions.
packages/​typescript/​src/​api/​async/​api.ts Exposes asynchronous utility and type-reference resolution methods.

Review effort: Balanced

Comment thread tsc/internal/api/module_resolution.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Templated type roots are treated as literal paths during module resolution, and option finalization drops the build flag needed to calculate build-info paths.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread tsc/internal/api/module_resolution.go Resolved
Comment thread tsc/internal/api/session.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Finalization drops the internal noDtsResolution option, and ${configDir} paths can resolve against the working directory instead of the config file directory.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread tsc/internal/api/session.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Valid file URIs can cause module resolution failures, and invalid enum options can trigger a panic instead of an invalid-request error.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread tsc/internal/api/module_resolution.go Resolved
Comment thread tsc/internal/api/module_resolution.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Invalid enum inputs can panic or be truncated, malformed resolver options can silently change resolution, and case variants of ${configDir} are expanded incorrectly.

4 open issues
1 resolved since last review

Review effort: Balanced

Comment thread tsc/internal/api/module_resolution.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Resolving an existing mapped .box file with typeRoots: [] panics during type-reference lookup; mapped source extensions must be excluded while preserving declaration-shim fallback.

2 open issues
3 resolved since last review

Review effort: Balanced

Comment thread tsc/internal/api/module_resolution.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The extension guard still permits a panic for registered package type entries and blocks mapped files in the typeRoots fallback.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread tsc/internal/module/resolver.go Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the new resolution utilities and API support.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

return continueSearching()
default:
isExtraExtension := slices.Contains(r.resolver.extraExtensions, originalExtension)
isExtraExtension := r.extensions&extensionsTypeScript != 0 && slices.Contains(r.resolver.extraExtensions, originalExtension)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by fix related to content mappers found during Copilot review

@andrewbranch
Andrew Branch (andrewbranch) marked this pull request as ready for review November 19, 2026 23:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants