Skip to content

[api] Add .getNonMissingTypeOfSymbol() method - #63956

Open
Tom Mrazauskas (mrazauskas) wants to merge 1 commit into
microsoft:mainfrom
mrazauskas:add-getNonMissingTypeOfSymbol
Open

[api] Add .getNonMissingTypeOfSymbol() method#63956
Tom Mrazauskas (mrazauskas) wants to merge 1 commit into
microsoft:mainfrom
mrazauskas:add-getNonMissingTypeOfSymbol

Conversation

@mrazauskas

Copy link
Copy Markdown
Contributor

Reopening microsoft/typescript-go#4701

This PR adds the .getNonMissingTypeOfSymbol() getter to the checker instance.

As it was mentioned in microsoft/typescript-go#4701 (comment), an alternative solution could be changing the implementation of handleGetTypeOfSymbol(). Replacing checker.GetTypeOfSymbol(symbol) with checker.GetTypeOfSymbolAtLocation(symbol, nil) would enable .getTypeOfSymbol() to respect the exactOptionalPropertyTypes option without adding an additional method.

Fixes #63829

Signed-off-by: mrazauskas <tom@mrazauskas.de>

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

Adds a checker API that returns symbol types while respecting exactOptionalPropertyTypes, resolving #63829.

Changes:

  • Exposes and registers getNonMissingTypeOfSymbol.
  • Adds synchronous and asynchronous TypeScript APIs.
  • Tests behavior with exact optional property types enabled and disabled.

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 Exposes the checker operation.
tsc/internal/api/session.go Handles the new API request.
tsc/internal/api/proto.go Registers protocol serialization.
packages/typescript/src/api/proto.generated.ts Adds generated protocol typing.
packages/typescript/src/api/sync/api.ts Adds the synchronous API.
packages/typescript/src/api/async/api.ts Adds the asynchronous API.
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.

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

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Add API to get symbol type that respects the exactOptionalPropertyTypes option

3 participants