[api] Add GenericType type - #64190
Conversation
Signed-off-by: mrazauskas <tom@mrazauskas.de>
| } | ||
|
|
||
| /** Generic types */ | ||
| export type GenericType = InterfaceType & TypeReference; |
There was a problem hiding this comment.
The exact type definition in Strada is:
interface GenericType extends InterfaceType, TypeReference {
}There was a problem hiding this comment.
Why the change to an intersection?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
🟢 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
GenericTypein 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>
There was a problem hiding this comment.
🟡 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
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 { |
There was a problem hiding this comment.
Suggested by Copilot. In Strada, TupleType does extend GenericType.
There was a problem hiding this comment.
🟡 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
Fixes #64189
This PR adds the missing
GenericTypetype.