From c023308703ef27b4af3dff89ecab89c57ff62d46 Mon Sep 17 00:00:00 2001 From: "aspire-repo-bot[bot]" <268009190+aspire-repo-bot[bot]@users.noreply.github.com> Date: Sat, 23 May 2026 16:23:09 +0000 Subject: [PATCH 1/2] docs: document async chaining support in TypeScript AppHosts Documents the async chaining feature introduced in microsoft/aspire#17400. TypeScript AppHosts can now chain through generated async methods that return wrapper types with a single await, using the new PromiseLike thenable wrapper pattern emitted by the code generator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../docs/app-host/typescript-apphost.mdx | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/frontend/src/content/docs/app-host/typescript-apphost.mdx b/src/frontend/src/content/docs/app-host/typescript-apphost.mdx index c63d9719c..752c0d328 100644 --- a/src/frontend/src/content/docs/app-host/typescript-apphost.mdx +++ b/src/frontend/src/content/docs/app-host/typescript-apphost.mdx @@ -333,6 +333,32 @@ The `aspire doctor` command checks that the required JavaScript toolchain execut aspire doctor ``` +## Async chaining + +TypeScript AppHosts support fluent chaining for builder methods — for example, `builder.addContainer(...).withReference(...)` — so you can build resource graphs in a compact, readable style. Starting with Aspire 13.4, the generated SDK extends this to **all** generated async methods that return a chainable wrapper type: environment helpers, execution-context queries, and endpoint property accessors. + +Previously, using these methods required splitting the chain or using a double `await`: + +```typescript title="apphost.ts (before)" +// Two separate awaits were needed when chaining through async wrapper-returning methods +const envContext = await builder.environment(); +const isDevelopment = await envContext.isDevelopment(); +``` + +Now you can chain through them with a **single `await`**: + +```typescript title="apphost.ts (after)" +const isDevelopment = await builder.environment().isDevelopment(); +const isRunMode = await context.executionContext().isRunMode(); +const endpointHost = await container.getEndpoint("http").property(EndpointProperty.Host); +``` + +This works because the code generator now emits a `*Promise` thenable wrapper for every generated async method whose return type is itself a chainable wrapper. The thenable implements `PromiseLike`, so a single `await` at the end of the chain resolves through any number of wrapper-returning steps. + + + ## TypeScript validation before startup Before starting a TypeScript AppHost, the Aspire CLI runs `tsc --noEmit` to check for type errors to prevent the dashboard and resources from starting in a partially broken state. If your AppHost has TypeScript compile errors, `aspire run` and `aspire publish` stop before the AppHost launches and display the diagnostic output: From ce2d7bf09dec8d5ed9dc8b105e43713bde32f89f Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 26 May 2026 08:22:16 -0500 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/frontend/src/content/docs/app-host/typescript-apphost.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/content/docs/app-host/typescript-apphost.mdx b/src/frontend/src/content/docs/app-host/typescript-apphost.mdx index 752c0d328..e5cd18b7a 100644 --- a/src/frontend/src/content/docs/app-host/typescript-apphost.mdx +++ b/src/frontend/src/content/docs/app-host/typescript-apphost.mdx @@ -353,7 +353,7 @@ const isRunMode = await context.executionContext().isRunMode(); const endpointHost = await container.getEndpoint("http").property(EndpointProperty.Host); ``` -This works because the code generator now emits a `*Promise` thenable wrapper for every generated async method whose return type is itself a chainable wrapper. The thenable implements `PromiseLike`, so a single `await` at the end of the chain resolves through any number of wrapper-returning steps. +This works because the code generator now emits a thenable wrapper for every generated async method whose return type is itself a chainable wrapper.