Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Docs: TypeScript AppHost DOES expose withEndpointsInEnvironment (project-resources page says it does not)

クローズ 初心者向け
#1,464 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
documentation

調査の方向性

src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx を開き、「Filter endpoints in environment variables.」の下にある TypeScript タブを見つけます。既存のガイダンスを src/Aspire.Hosting/Ats/CoreExports.cs および tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.mts と比較します。タブに allow-list 形式が記載され、示されている endpoint の例が含まれ、C# の predicate overload との違いが説明されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Page

integrations/dotnet/project-resources → "Filter endpoints in environment variables"

Source: project-resources.mdx

Problem

The TypeScript tab of the "Filter endpoints in environment variables" section states:

"The TypeScript AppHost doesn't currently expose WithEndpointsInEnvironment. To exclude an endpoint from environment variable injection, define only the endpoints you need and omit the admin endpoint from the project resource."

But the TypeScript AppHost does expose it. There is a dedicated ATS-friendly overload marked [AspireExport] — src/Aspire.Hosting/Ats/CoreExports.cs:

[AspireExport]
public static IResourceBuilder<ProjectResource> WithEndpointsInEnvironment(
    this IResourceBuilder<ProjectResource> resource,
    string[] endpointNames)

The predicate overload WithEndpointsInEnvironment(Func<EndpointAnnotation, bool> filter) is [AspireExportIgnore] because Func<> isn't ATS-compatible, and its comment explicitly points to the array-based export as "the ATS-friendly implementation."

It appears in the generated TypeScript surface — src/Aspire.Hosting/api/Aspire.Hosting.ats.txt:

Aspire.Hosting/withEndpointsInEnvironment(endpointNames: string[]) -> Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource

and the repository's own polyglot TypeScript AppHost uses it — tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.mts:

await project.withEndpointsInEnvironment(["https"]);
Note on semantics

The exported TypeScript overload takes an allow-list of endpoint names to include (string[]), which is the inverse of the C# predicate example on the page (which excludes endpoints by returning false). So the correct TypeScript guidance to keep admin out of the environment is to list the endpoints you want to keep:

await builder.addProject("apiservice", "../Networking.ApiService/Networking.ApiService.csproj")
    .withHttpsEndpoint()
    .withHttpsEndpoint({ port: 19227, name: "admin" })
    .withEndpointsInEnvironment(["https"]); // include only "https"; "admin" is excluded
Suggested fix

Replace the "doesn't currently expose WithEndpointsInEnvironment" note in the TypeScript tab with the withEndpointsInEnvironment(endpointNames) allow-list form and an example, noting the include-vs-exclude semantic difference from the C# predicate overload.

Provenance

aspire.dev release/13.5 (project-resources.mdx); aspire release/13.5 (CoreExports.cs, Aspire.Hosting.ats.txt, PolyglotAppHosts TypeScript AppHost). Confirmed working live against the 13.5 candidate CLI 13.5.0-pr.17553.

主要言語
MDX
スター
200
フォーク
93
平均マージ
2日 8時間
マージ済み PR(30日)
62

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/aspire.dev のほかの issue

microsoft/aspire.dev の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。