Summary
When using bundledPackages options, import declaration from dir generates incorrect dts result.
e.g. configure "bundledPackages": ["foo"], with following foo package files:
- index.d.ts
export { Bar } from './bar-dir';
- bar-dir/index.d.ts
and following entry dts file:
generates dts result:
import { Bar } from './bar-dir';
export { Bar }
Repro steps
Expected result:
Previous example should generate:
export declare interface Bar {}
or reproduce by: https://github.com/adventure-yunfei/api-extractor-issue--bundledPackages
Details
Debugged and found the reason, introduced by #3321. For import declaration from dir (e.g., import { A } from "./a", while resolved file is a/index.d.ts), TypeScriptInternals.getResolvedModule (in ExportAnalyzer.ts) returns the result without packageId data, thus bundledPackages check is skipped (cause bug here).
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question |
Answer |
@microsoft/api-extractor version? |
7.53.1 |
| Operating system? |
Mac |
| API Extractor scenario? |
rollups (.d.ts) |
| Would you consider contributing a PR? |
No |
| TypeScript compiler version? |
5.8.2 |
Node.js version (node -v)? |
v16.20.0 |
Summary
When using
bundledPackagesoptions, import declaration from dir generates incorrect dts result.e.g. configure
"bundledPackages": ["foo"], with followingfoopackage files:and following entry dts file:
generates dts result:
Repro steps
Expected result:
Previous example should generate:
or reproduce by: https://github.com/adventure-yunfei/api-extractor-issue--bundledPackages
Details
Debugged and found the reason, introduced by #3321. For import declaration from dir (e.g.,
import { A } from "./a", while resolved file isa/index.d.ts),TypeScriptInternals.getResolvedModule(inExportAnalyzer.ts) returns the result withoutpackageIddata, thusbundledPackagescheck is skipped (cause bug here).Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractorversion?node -v)?