API: make object registries project-specific to avoid id collisions on types and signatures#4341
Open
piotrtomiak wants to merge 4 commits into
Open
API: make object registries project-specific to avoid id collisions on types and signatures#4341piotrtomiak wants to merge 4 commits into
piotrtomiak wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds API support for extracting the true/false branches of conditional types, and fixes cross-project handle collisions by scoping type/symbol/signature registries per project within a snapshot.
Changes:
- Introduced
getTrueTypeOfConditionalType/getFalseTypeOfConditionalTypemethods end-to-end (checker exports, API proto, session handlers, TS clients, tests). - Replaced snapshot-global registries with per-project registries to prevent ID collisions when multiple projects are open in the same snapshot.
- Updated sub-property endpoint params to include
projectso the server can resolve handles in the correct project registry.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/checker/exports.go | Exposes conditional-type true/false branch getters on Checker. |
| internal/api/session.go | Scopes registries per project; threads projectID through registration/handle-resolution and adds new API handlers. |
| internal/api/proto.go | Adds new method names + unmarshalers; adds project to sub-property param types. |
| _packages/native-preview/src/api/sync/api.ts | Moves object registries from snapshot-level to project-level; adds conditional-type branch methods. |
| _packages/native-preview/src/api/async/api.ts | Async equivalent of sync client changes (project-level registries + new methods). |
| _packages/native-preview/test/sync/api.test.ts | Adds tests for conditional-type branch getters and multi-project type ID collision regression. |
| _packages/native-preview/test/async/api.test.ts | Async equivalent tests for new methods and multi-project collision regression. |
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.
It will also make it easier to refactor checker method into Type/Symbol/Signature classes.