Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[api-extractor] Keep separate d.ts files but filter public API

未关闭
#5,453 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞

调研方向

Start by reviewing API Extractor's reporting, rollups, and docs scenarios, especially dtsRollup, alongside TypeScript's per-module .d.ts output and the package.json exports mapping. Define how modules are crawled, public exports are filtered, and matching output files are generated. Done means separate non-empty .d.ts files preserve the source hierarchy, with discrepancies reported.

由索引模型根据 Issue 内容生成。

描述

Summary

I'd like to use the API extractor functionalities to track my public API and filter anything non-public from my d.ts files.

At the same time I want to keep separate d.ts files (one for every .mjs just like typescript prints it).

Unfortunately the dtsRollup works in a "bundle/barrel module" mindset where you only have a single library file.

Details

In the era of ESM the practice of "bundling" when publishing packages seem to vanish to support features like tree-shaking better. Same applies for "barrel modules" which contain all exports of your library.

Following this strategy it would be great if api-extractor could do it's magic without expecting a single barrel d.ts.

Imagine a tsc output of .mjs and .d.ts files matching the .ts file hierarchy. I'd expect:

  1. api-extractor to crawl the modules of my project and build the public API surface.
  2. Potentially the exports property of the package.json is consulted to filter what's really public from an NPM perspective (mapping might be tricky though).
  3. api-extractor writes the output d.ts files with the same hierarchy to a given output directory (empty d.ts files are omitted).
  4. Any warnings on discrepancies of exports are reported (e.g. a public api exposes a filtered private one).

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.53.3
Operating system? Any
API Extractor scenario? reporting (.api.md) / rollups (.d.ts) / docs (.api.json)
Would you consider contributing a PR? Maybe, depends on the efforts
TypeScript compiler version? 5.9.3
Node.js version (node -v)? v24.11.0
主要语言
TypeScript
星标
6.5k
派生
708
平均合并
4 天 13 小时
30 天内合并 PR
62

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/rushstack 的其他 Issue

查看 microsoft/rushstack 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。