Add missing APIs required for WebStorm integration.#4113
Conversation
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 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
TypeResponseto includefreshType,intrinsicName,isThisType, and alias metadata. - Updated native-preview (sync/async) TypeScript client types and
Checkerwrapper 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. |
|
@microsoft-github-policy-service agree company="JetBrains" |
| /** Get the fresh version of this literal type, if any */ | ||
| getFreshType(): Promise<Type | undefined>; |
There was a problem hiding this comment.
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.
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.