Skip to content

Expose some type checker features that were available in TS6 - #64535

Open
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 4 commits into
microsoft:mainfrom
bloomberg:expose-type-checker-features
Open

Titian Cernicova-Dragomir (dragomirtitian) wants to merge 4 commits into
microsoft:mainfrom
bloomberg:expose-type-checker-features

Conversation

@dragomirtitian

Copy link
Copy Markdown
Contributor

Fixes #64533

Add 4 checker features that were available in TS6 and that we are using for out docs system:

  • UnionType.getOrigin() — returns the pre-normalization union (e.g. recovers named unions collapsed during flattening) > - This was marked as internal in 6.0, but it is useful for the doc system to know where the type is coming from.
  • Checker.symbolToString(symbol, enclosingDeclaration?, meaning?, flags?) — exposes checker's symbol formatting; adds SymbolFormatFlags enum.
  • UniqueESSymbolType.escapedName + Type.isUniqueESSymbolType() — exposes escaped name for unique symbol types.
  • ConditionalType.getInferTypeParameters() — exposes type parameters bound by a conditional type's infer clause.

@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 29, 2026
Copilot AI balanced review requested due to automatic review settings September 29, 2026 16:22

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.

Copilot review overview

🟡 Changes recommended

Zero-valued formatting arguments are misinterpreted, escaped-name typing is widened, and unique-symbol behavior lacks regression coverage.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Exposes additional TypeScript 6 checker capabilities through the async and sync APIs.

Changes:

  • Adds union-origin, conditional-inference, unique-symbol, and symbol-formatting APIs.
  • Adds protocol support and SymbolFormatFlags.
  • Adds API and parity tests.
File Description
tsc/​internal/​checker/​types.go Exposes checker type metadata.
tsc/​internal/​api/​session.go Handles new API requests.
tsc/​internal/​api/​proto.go Defines protocol methods and payloads.
tsc/​internal/​api/​enum_values_generated.go Registers symbol-format enum values.
tools/​scripts/​tsc/​generate-enums.ts Adds enum generation configuration.
packages/​typescript/​test/​sync/​api.test.ts Adds generated sync API tests.
packages/​typescript/​test/​sync/​api-generators.test.ts Adds batching parity coverage.
packages/​typescript/​test/​async/​api.test.ts Adds async API tests.
packages/​typescript/​src/​enums/​symbolFormatFlags.ts Adds runtime enum output.
packages/​typescript/​src/​enums/​symbolFormatFlags.enum.ts Adds typed enum output.
packages/​typescript/​src/​api/​sync/​types.ts Adds generated sync declarations.
packages/​typescript/​src/​api/​sync/​api.ts Adds generated sync implementations.
packages/​typescript/​src/​api/​proto.generated.ts Adds generated protocol declarations.
packages/​typescript/​src/​api/​async/​types.ts Adds async public type declarations.
packages/​typescript/​src/​api/​async/​api.ts Implements the async APIs.
Files not reviewed (1)
  • tsc/internal/api/enum_values_generated.go: Generated file

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +326 to +327
/** The escaped name of the unique symbol, e.g. `"__@startWork@7"` */
readonly escapedName: string;
Comment thread tsc/internal/api/proto.go
Comment on lines +1746 to +1747
Meaning uint32 `json:"meaning,omitempty"`
Flags int32 `json:"flags,omitempty"`
Comment on lines +3554 to +3556
isUniqueESSymbolType(): this is UniqueESSymbolType {
return isUniqueESSymbolType(this);
}
@typescript-automation typescript-automation Bot added For Milestone Bug PRs that fix a bug with a specific milestone and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 29, 2026

This branch has not been deployed

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

Labels

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

[API] Expose some type checker features that were available in TS6

3 participants