Skip to content

Add some methods from Type to Checker. - #63918

Open
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 1 commit into
microsoft:mainfrom
bloomberg:add-sample-type-methods-to-checker
Open

Add some methods from Type to Checker.#63918
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 1 commit into
microsoft:mainfrom
bloomberg:add-sample-type-methods-to-checker

Conversation

@dragomirtitian

Copy link
Copy Markdown
Contributor

Partial fix for #63917. This adds the methods that we were using from Type to Checker in order to make them batched. If there is appetite to add all of them, I can expand the PR.

Fixes #63917

Copilot AI balanced review requested due to automatic review settings August 20, 2026 15:49
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Aug 20, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 20, 2026

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.

Pull request overview

Adds batched Checker accessors for selected Type properties to reduce IPC overhead.

Changes:

  • Adds batched symbol, alias-symbol, and alias-type-argument protocol endpoints.
  • Exposes synchronous and asynchronous Checker overloads with cache-aware batching.
  • Adds sync and async API tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsc/internal/api/session.go Implements batched request handlers.
tsc/internal/api/proto.go Defines protocol methods and parameters.
packages/typescript/src/api/sync/api.ts Adds synchronous Checker accessors.
packages/typescript/src/api/async/api.ts Adds asynchronous Checker accessors.
packages/typescript/src/api/proto.ts Adds nested type-array method typing.
packages/typescript/src/api/proto.generated.ts Updates generated protocol declarations.
packages/typescript/test/sync/api.test.ts Tests synchronous batching and caching.
packages/typescript/test/async/api.test.ts Tests asynchronous batching and caching.
Suppressed comments (2)

packages/typescript/test/sync/api.test.ts:4503

  • This assertion only proves that getOrCreateType preserves object identity; it still passes if the cached argument is sent to and returned by the server. Please inspect the batched request (or otherwise count the requested type IDs) so this test actually guards the no-refetch optimization described by its name.
            assert.strictEqual(results[0][0], cachedXArgs[0]);

packages/typescript/test/async/api.test.ts:4495

  • This assertion only checks cached object identity, which getOrCreateType preserves even after a redundant server response. Please observe the batch request and verify that the cached argument's type ID is omitted so the test fails if the no-refetch filtering regresses.
            assert.strictEqual(results[0][0], cachedXArgs[0]);

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

const results = project.checker.getSymbolOfType([typeFoo, typeBar]);
assert.equal(results.length, 2);
// The already-cached symbol should be reused as-is (same object identity), not re-fetched.
assert.strictEqual(results[0], cachedFooSymbol);
const results = await project.checker.getSymbolOfType([typeFoo, typeBar]);
assert.equal(results.length, 2);
// The already-cached symbol should be reused as-is (same object identity), not re-fetched.
assert.strictEqual(results[0], cachedFooSymbol);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

[7.1 API] Methods from Type should also exist on the Checker

2 participants