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

[api-extractor] Export aliases lost with `bundledPackages`

オープン
#5,920 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
nodejs, typescript

調査の方向性

Start with the linked bundledPackages-reexport-aliased reproduction and run the documented yarn install and build commands. Compare package-b/api-reports/package-b.api.md and package-b/dist/package-b-public.d.ts with package-a/src/FooInternal.ts and package-a/src/index.ts, then trace bundledPackages alias resolution. Done means Baz uses FooExternal and the ae-forgotten-export warning is absent in both outputs.

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

説明

[api-extractor] bundledPackages uses a source declaration name instead of its exported alias

Summary

When an aliased API export from a package listed in bundledPackages is referenced, API Extractor uses the original source declaration name when referencing that API from the consuming package. The original name is not part of the dependency's public API, so the generated API model and report contain an incorrect reference and an ae-forgotten-export warning. The incorrect name is also used in the generated declaration rollup.

Repro steps

The minimal reproduction is available at:

https://github.com/Josmithr/api-extractor-playground/tree/bundledPackages-reexport-aliased

  1. Clone the reproduction branch.

  2. From the repository root, install dependencies and build package-b with its dependency:

    yarn install --frozen-lockfile
    yarn lerna run build --scope package-b --include-dependencies
    
  3. Inspect packages/package-b/api-reports/package-b.api.md and packages/package-b/dist/package-b-public.d.ts.

In package-a, FooInternal is exported from the package entry point as FooExternal:

// package-a/src/FooInternal.ts
export type FooInternal = string;

// package-a/src/index.ts
export { FooInternal as FooExternal } from './FooInternal.js';

package-b lists package-a in bundledPackages and references the public name FooExternal:

import type { FooExternal } from 'package-a';

/** @public */
export type Baz = FooExternal;

Expected result:

The API report should preserve the name exported by package-a:

export type Baz = FooExternal;

Actual result:

The API report uses the private source declaration name and reports it as a forgotten export:

// Warning: (ae-forgotten-export) The symbol "FooInternal" needs to be exported by the entry point index.d.ts
//
// @public
export type Baz = FooInternal;

The public declaration rollup similarly contains:

export declare type Baz = FooInternal;
declare type FooInternal = string;

Details

This appears to occur while API Extractor follows the FooExternal re-export into the bundled package. It resolves the underlying declaration correctly, but uses that declaration's local name (FooInternal) instead of the name exported from the dependency's entry point (FooExternal) when generating references in package-b.

Explicitly re-exporting FooExternal from package-b avoids the issue:

export type { FooExternal } from 'package-a';
export type { Baz } from './Baz.js';

With this re-export, the API report and declaration rollup both use FooExternal, and the ae-forgotten-export warning disappears. This suggests the incorrect name is used specifically when the bundled API is referenced by an exported declaration but is not itself exported from the consumer's entry point.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.58.12
Operating system? Linux x64 (Ubuntu 24.04)
API Extractor scenario? Reporting (.api.md) and rollups (.d.ts)
Would you consider contributing a PR? Possibly, with maintainer guidance
TypeScript compiler version? 5.9.3
Node.js version (node -v)? v24.14.0
主要言語
TypeScript
スター
6.5k
フォーク
708
平均マージ
5日 19時間
マージ済み PR(30日)
48

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

microsoft/rushstack のほかの issue

microsoft/rushstack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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