[release/13.2] Fix TypeScript codegen typing for reusable packages#15631
[release/13.2] Fix TypeScript codegen typing for reusable packages#15631sebastienros wants to merge 3 commits intorelease/13.2from
Conversation
- generate structural handle-bearing input types for interface-handle parameters - align generated wrapper property objects with setter capabilities - update snapshots and regenerate tracked TypeScript validation apphost modules Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15631Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15631" |
|
The only thing to check mostly is the vode generator class and the base/transport files in the same folder. The other changes are just generated code from samples. These files are all gone in |
|
@DamianEdwards would you mind checking if that implementation solves your problem? |
There was a problem hiding this comment.
Pull request overview
Fixes a TypeScript codegen regression (#15507) by shifting generated wrapper typings away from nominal typing across package boundaries and aligning transport behavior for handles/cancellation.
Changes:
- Updates generated TypeScript transport/base modules to use structural “handle-bearing” inputs, adds cancellation token abstractions, and adds argument marshalling/validation.
- Adds/refreshes
aspire.config.jsonfor multiple polyglot TypeScript ValidationAppHost samples and updates.codegen-hashtracking files. - Ensures returned wrapper types remain structural and updates property-object wrapper behavior (via regenerated outputs).
Reviewed changes
Copilot reviewed 73 out of 253 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Storage/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/transport.ts | Updates transport: cancellation tokens, argument validation, handle wrapping, connection/auth changes. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/base.ts | Updates base types: structural reference expressions, cancellation token types, transport serialization changes. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.SignalR/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.SignalR/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.SignalR/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Search/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Search/ValidationAppHost/.modules/transport.ts | Updates transport: cancellation tokens, argument validation, handle wrapping, connection/auth changes. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Search/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Search/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Redis/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Redis/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Redis/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Kusto/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Kusto/ValidationAppHost/.modules/transport.ts | Updates transport: cancellation tokens, argument validation, handle wrapping, connection/auth changes. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Kusto/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Kusto/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Functions/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Functions/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.Functions/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppService/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppService/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppService/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/aspire.config.json | Adds TypeScript ValidationAppHost configuration and package list. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/.modules/base.ts | Regenerates base module with structural reference expressions + cancellation token support. |
| playground/polyglot/TypeScript/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/.modules/.codegen-hash | Updates tracked TS codegen output hash. |
playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/transport.ts
Show resolved
Hide resolved
playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/transport.ts
Show resolved
Hide resolved
playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/transport.ts
Show resolved
Hide resolved
playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/base.ts
Show resolved
Hide resolved
playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/transport.ts
Outdated
Show resolved
Hide resolved
playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/transport.ts
Show resolved
Hide resolved
playground/polyglot/TypeScript/Aspire.Hosting.Azure.Sql/ValidationAppHost/.modules/transport.ts
Show resolved
Hide resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JamesNK
left a comment
There was a problem hiding this comment.
Reviewed the changes under src/Aspire.Hosting.CodeGeneration.TypeScript and tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests. The structural typing approach for cross-package reuse looks sound.
Three comments inline — the ancestors set mutation in marshalTransportValue is likely a real bug when objects share references in arrays/maps processed via Promise.all.
src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs
Show resolved
Hide resolved
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
|
🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23633429036 |
|
So ITypeName is very C#py. What would these interfaces be called if they were normal TS interfaces. Should we let the interfaces be the normal names and the implementations have different names instead of using an I prefix. |
chatgpt says ITypeName was the common standard. It's more common to not prefix with I in modern TypeScript |
Description
This fixes the TypeScript codegen regression behind #15507 by avoiding nominal typing for reusable generated wrappers across package boundaries.
The change set updates the generated TypeScript surface to use structural handle-bearing input types for interface-handle parameters, keeps structural interfaces for returned wrapper types, aligns generated property-object wrappers with setter capabilities, and refreshes the tracked polyglot TypeScript validation outputs.
Validation:
./dotnet.sh test tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"restore+tsc --noEmitacross all 48playground/polyglot/TypeScript/*/ValidationAppHostsamplesFixes #15507
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: