Skip to content

API: add checker methods to get true and false types of a conditional type#4337

Open
piotrtomiak wants to merge 1 commit into
microsoft:mainfrom
JetBrains:api-true-false-types
Open

API: add checker methods to get true and false types of a conditional type#4337
piotrtomiak wants to merge 1 commit into
microsoft:mainfrom
JetBrains:api-true-false-types

Conversation

@piotrtomiak

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 16, 2026 15:06

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds API surface to retrieve the true/false branch types of a conditional type through the Checker, wiring it through the Go RPC layer and exposing it in both sync and async TypeScript clients.

Changes:

  • Exported Checker.GetTrueTypeOfConditionalType / Checker.GetFalseTypeOfConditionalType in Go.
  • Added new RPC methods/handlers and proto method registration for both operations.
  • Added sync/async TypeScript client methods plus corresponding tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/checker/exports.go Exposes conditional-type branch getters on the public Checker API.
internal/api/session.go Routes and implements new RPC handlers that resolve a type handle and return the corresponding branch type.
internal/api/proto.go Registers two new RPC method names and their unmarshallers.
_packages/native-preview/src/api/sync/api.ts Adds sync TS client methods for conditional-type true/false branches.
_packages/native-preview/src/api/async/api.ts Adds async TS client methods for conditional-type true/false branches.
_packages/native-preview/test/sync/api.test.ts Adds sync test coverage validating branch types for a conditional type alias.
_packages/native-preview/test/async/api.test.ts Adds async test coverage validating branch types for a conditional type alias.

Comment thread internal/api/session.go
Comment thread internal/api/session.go
Comment thread _packages/native-preview/src/api/sync/api.ts
@RyanCavanaugh RyanCavanaugh added this to the Post-7.0 milestone Jun 16, 2026
@piotrtomiak piotrtomiak force-pushed the api-true-false-types branch from ff1231d to 7029cb0 Compare June 16, 2026 17:31
@mrazauskas

mrazauskas commented Jun 17, 2026

Copy link
Copy Markdown

Could you link to #2851, please?

I was suggesting adding .getTrueType() and .getFalseType() to ConditionalType, but anyway this would solve the same problem.

@piotrtomiak

Copy link
Copy Markdown
Contributor Author

@mrazauskas - what do you mean by link? In the git commit message?

I was suggesting adding .getTrueType() and .getFalseType() to ConditionalType, but anyway this would solve the same problem.

I am planning to make this change once #4341 is merged, since this requires association between Type and projectId on the API side, which is now missing

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants