Expose Checker.getAwaitedType on the unstable API - #64000
Open
Baptiste Jamin (baptistejamin) wants to merge 1 commit into
Open
Expose Checker.getAwaitedType on the unstable API#64000Baptiste Jamin (baptistejamin) wants to merge 1 commit into
Baptiste Jamin (baptistejamin) wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot started reviewing on behalf of
Baptiste Jamin (baptistejamin)
August 25, 2026 12:42
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Exposes getAwaitedType through the unstable synchronous and asynchronous TypeScript APIs.
Changes:
- Adds checker and protocol support for awaited-type requests.
- Implements sync and async client methods with nullable results.
- Tests promise unwrapping, non-thenables, nesting, and recursive thenables.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tsc/internal/checker/exports.go |
Exports the internal awaited-type operation. |
tsc/internal/api/session.go |
Handles awaited-type API requests. |
tsc/internal/api/proto.go |
Registers the new protocol method. |
packages/typescript/src/api/proto.generated.ts |
Adds generated protocol typing. |
packages/typescript/src/api/sync/api.ts |
Exposes the synchronous checker method. |
packages/typescript/src/api/async/api.ts |
Exposes the asynchronous checker method. |
packages/typescript/test/sync/api.test.ts |
Tests synchronous behavior. |
packages/typescript/test/async/api.test.ts |
Tests asynchronous behavior. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Author
|
@microsoft-github-policy-service agree |
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.
getAwaitedTypealready exists on the TypeScript 6 checker (ts.TypeChecker.getAwaitedType) and internally in the Go checker, but it is not wired throughtypescript/unstable. This PR exports it on the JS API so callers can get the type ofawait expr.Behavior matches the existing checker:
Promise<string>→string,Promise<Promise<number>>→number)undefinedfor a circular thenablePromise<T>asAwaited<T>when neededThis is needed by typescript-eslint (
discriminateAnyType,no-unsafe-return) and other tools that still callchecker.getAwaitedType.