Skip to content

Add missing APIs required for WebStorm integration.#4113

Open
piotrtomiak wants to merge 7 commits into
microsoft:mainfrom
JetBrains:proxy-fork
Open

Add missing APIs required for WebStorm integration.#4113
piotrtomiak wants to merge 7 commits into
microsoft:mainfrom
JetBrains:proxy-fork

Conversation

@piotrtomiak
Copy link
Copy Markdown

WebStorm heavily uses types from the service for inspections, find usages, refactorings and framework support. With the node implementation, it was relatively easy to use internal APIs, which allowed us to migrate from our type evaluator to the service type evaluator. With TS-GO implementation we are missing several APIs, which would allow us to migrate without any problems. Please review the proposition and let us know, which of these could make it into the public API. We would love to avoid any forking of the source code.

Copilot AI review requested due to automatic review settings May 30, 2026 18:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.

This PR extends the checker/type API surface to expose additional TypeScript type metadata (fresh literal types, alias instantiation info, intrinsic/type-parameter details) and adds an assignability query.

Changes:

  • Added new server-side type accessors and API methods: fresh literal type, alias type args/symbol, and isTypeAssignableTo.
  • Expanded TypeResponse to include freshType, intrinsicName, isThisType, and alias metadata.
  • Updated native-preview (sync/async) TypeScript client types and Checker wrapper to surface the new capabilities.

Reviewed changes

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

Show a summary per file
File Description
internal/checker/types.go Adds exported getters for alias and fresh literal type.
internal/api/session.go Wires new API methods and handlers for fresh type, alias metadata, and assignability.
internal/api/proto.go Adds method constants/unmarshalers and extends TypeResponse/params structs.
_packages/native-preview/src/api/sync/types.ts Extends TS type interfaces for intrinsic/type-parameter/literal/alias metadata.
_packages/native-preview/src/api/sync/api.ts Implements new TS client methods (isTypeAssignableTo, alias/fresh accessors) and maps new response fields.
_packages/native-preview/src/api/proto.ts Extends TS wire protocol TypeResponse.
_packages/native-preview/src/api/async/types.ts Async equivalents of the TS type interface extensions.
_packages/native-preview/src/api/async/api.ts Async equivalents of the TS client method additions and response mapping.

Comment thread _packages/native-preview/src/api/sync/api.ts
Comment thread _packages/native-preview/src/api/async/api.ts
Comment thread internal/api/session.go
Comment thread _packages/native-preview/src/api/sync/api.ts
Comment thread _packages/native-preview/src/api/sync/api.ts
Comment thread _packages/native-preview/src/api/async/api.ts
Comment thread _packages/native-preview/src/api/async/api.ts
Comment thread _packages/native-preview/src/api/sync/api.ts
@piotrtomiak
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="JetBrains"

Comment on lines +46 to +47
/** Get the fresh version of this literal type, if any */
getFreshType(): Promise<Type | undefined>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you implement the suggestion from #4146 and put this on a separate interface, and include getRegularType() as well? The reason, it seems, is that enum types have TypeFlags.Freshable === TypeFlags.Enum | TypeFlags.Literal, so the hierarchy as you have it here prevents you from accessing the fresh/regular type on enum types.

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.

3 participants