Skip to content

[api] Add GenericType type - #64190

Merged
Andrew Branch (andrewbranch) merged 5 commits into
microsoft:mainfrom
mrazauskas:add-GenericType
Sep 9, 2026
Merged

[api] Add GenericType type#64190
Andrew Branch (andrewbranch) merged 5 commits into
microsoft:mainfrom
mrazauskas:add-GenericType

Conversation

@mrazauskas

Copy link
Copy Markdown
Contributor

Fixes #64189

This PR adds the missing GenericType type.

Signed-off-by: mrazauskas <tom@mrazauskas.de>
Copilot AI balanced review requested due to automatic review settings September 7, 2026 17:26
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 7, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 7, 2026
}

/** Generic types */
export type GenericType = InterfaceType & TypeReference;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The exact type definition in Strada is:

interface GenericType extends InterfaceType, TypeReference {
}

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.

Why the change to an intersection?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed it to interface e132a26.

I was not sure whether it should be an empty interface or an intersection. My comment above is not precise. In Strada, GenericType is declared as an interface with @internal properties, which emits as an empty interface.

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.

🟢 Approval recommended

The API additions are consistent across both variants and have targeted test coverage.

Pull request overview

Adds the missing GenericType API type and exposes generic targets through TypeReference.getTarget().

Changes:

  • Adds and exports GenericType in synchronous and asynchronous APIs.
  • Narrows getTarget() return types accordingly.
  • Tests access to generic target type parameters.
File summaries
File Description
packages/typescript/src/api/async/types.ts Defines GenericType and updates getTarget().
packages/typescript/src/api/async/api.ts Exports GenericType.
packages/typescript/src/api/sync/types.ts Adds generated synchronous type definitions.
packages/typescript/src/api/sync/api.ts Adds generated synchronous export.
packages/typescript/test/async/api.test.ts Tests asynchronous generic target parameters.
packages/typescript/test/sync/api.test.ts Tests synchronous generic target parameters.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

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.

🟡 Changes recommended

Both API hierarchies should model TupleType as extending the newly exposed GenericType.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread packages/typescript/src/api/async/types.ts Outdated
Comment thread packages/typescript/src/api/sync/types.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

/** Tuple type targets (ObjectFlags.Tuple) */
export interface TupleType extends InterfaceType {
export interface TupleType extends GenericType {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested by Copilot. In Strada, TupleType does extend GenericType.

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.

🟡 Changes recommended

Two changed declarations contain malformed line endings that may fail formatting validation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread packages/typescript/src/api/async/types.ts Outdated
Comment thread packages/typescript/src/api/sync/types.ts Outdated
Signed-off-by: mrazauskas <tom@mrazauskas.de>
@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Sep 9, 2026
@andrewbranch
Andrew Branch (andrewbranch) added this pull request to the merge queue Sep 9, 2026
Merged via the queue into microsoft:main with commit 8bf449b Sep 9, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Sep 9, 2026
@mrazauskas
Tom Mrazauskas (mrazauskas) deleted the add-GenericType branch September 9, 2026 15:36
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: Done

Development

Successfully merging this pull request may close these issues.

Add GenericType type to the API

3 participants