Skip to content

Fix TypeScriptAppHost playground app#14950

Merged
sebastienros merged 3 commits intorelease/13.2from
sebros/typescript-playground
Mar 4, 2026
Merged

Fix TypeScriptAppHost playground app#14950
sebastienros merged 3 commits intorelease/13.2from
sebros/typescript-playground

Conversation

@sebastienros
Copy link
Contributor

Fixes #14927

Copilot AI review requested due to automatic review settings March 4, 2026 18:46
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14950

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14950"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the TypeScript playground AppHost failing to start (timing out while waiting for the AppHost server) by aligning the generated TypeScript SDK/runtime with how the code generator emits ReferenceExpression usage and ensuring the runtime dependency needed to execute apphost.ts is present.

Changes:

  • Make ReferenceExpression constructible from either a template-literal expression (format + value providers) or a server-returned handle, and update JSON serialization accordingly.
  • Add tsx to the TypeScriptAppHost playground dev dependencies (required by the TypeScript AppHost runtime execution path).
  • Regenerate/update the playground’s .modules outputs and the TypeScript codegen snapshot to reflect the new base implementation.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/base.verified.ts Updates snapshot to reflect new ReferenceExpression constructor/serialization behavior.
src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/base.ts Updates the TypeScript SDK base to support handle-backed ReferenceExpression instances.
playground/TypeScriptAppHost/package.json Adds tsx so the playground can execute apphost.ts via the expected runtime tooling.
playground/TypeScriptAppHost/package-lock.json Lockfile update for the added tsx dependency (and transitive deps).
playground/TypeScriptAppHost/.modules/transport.ts Updates generated transport to match current callback/DTO behavior used by the host.
playground/TypeScriptAppHost/.modules/base.ts Updates generated base module to include the new ReferenceExpression implementation.
playground/TypeScriptAppHost/.modules/.codegen-hash Updates the codegen hash to reflect regenerated .modules outputs.
Files not reviewed (1)
  • playground/TypeScriptAppHost/package-lock.json: Language not supported

…cript SDK

The generated TypeScript SDK calls `new ReferenceExpression(handle, client)`
for server-returned properties like uriExpression and jdbcConnectionString,
but the constructor was private and only accepted (format, valueProviders).

This caused TS2673 compilation errors in all polyglot TypeScript apps.

Changes:
- Make constructor public with dual-mode support (expression + handle)
- Add constructor overloads to enforce valid parameter pairing at compile time
- Store _client field for forward compatibility with other handle-wrapping types
- Update toJSON() to delegate to handle serialization in handle mode
- Update verified snapshot to match

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros force-pushed the sebros/typescript-playground branch from bd9576b to c73f706 Compare March 4, 2026 19:02
Add a local .gitignore to override the global .aspire/ exclusion,
so that integration packages are tracked for this playground app.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros force-pushed the sebros/typescript-playground branch from c73f706 to e069fc2 Compare March 4, 2026 19:07
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit e069fc2:

Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AgentInitCommand_WithMalformedMcpJson_ShowsErrorAndExitsNonZero ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22684830281

@sebastienros sebastienros merged commit 9ba2bde into release/13.2 Mar 4, 2026
759 of 763 checks passed
@sebastienros sebastienros deleted the sebros/typescript-playground branch March 4, 2026 19:50
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 4, 2026
Copilot AI pushed a commit that referenced this pull request Mar 10, 2026
* Fix TypeScriptAppHost playground app

Fixes #14927

* Fix ReferenceExpression to support handle-based construction in TypeScript SDK

The generated TypeScript SDK calls `new ReferenceExpression(handle, client)`
for server-returned properties like uriExpression and jdbcConnectionString,
but the constructor was private and only accepted (format, valueProviders).

This caused TS2673 compilation errors in all polyglot TypeScript apps.

Changes:
- Make constructor public with dual-mode support (expression + handle)
- Add constructor overloads to enforce valid parameter pairing at compile time
- Store _client field for forward compatibility with other handle-wrapping types
- Update toJSON() to delegate to handle serialization in handle mode
- Update verified snapshot to match

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Include TypeScriptAppHost .aspire/settings.json in source control

Add a local .gitignore to override the global .aspire/ exclusion,
so that integration packages are tracked for this playground app.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants