Summary
If API Extractor is run on an entry point that re-exports a symbol from an ambient module, it's unable to resolve the ambient module, and thus throws an error.
Repro steps
- Clone https://github.com/zelliott/rushstack/tree/ambient-modules
- Run
rush rebuild -o api-extractor-scenarios
- Observe the error in the
ambientModule test scenario.
InternalError: Internal Error: getResolvedModule() could not resolve module name "bar"
/Users/zell/Developer/rushstack/build-tests/api-extractor-scenarios/lib/ambientModule/index.d.ts:2:1
Details
The problem seems to be in the TypeScript getResolvedModule helper. It doesn't seem to be able to resolve ambient modules. It's not clear to me if there's something wrong in my setup, if there's a bug in getResolvedModule, or if API Extractor has to use some other TS compiler API to resolve ambient modules.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question |
Answer |
@microsoft/api-extractor version? |
Latest |
| Operating system? |
All |
| API Extractor scenario? |
All |
| Would you consider contributing a PR? |
Yes |
| TypeScript compiler version? |
Latest |
Node.js version (node -v)? |
Latest |
Summary
If API Extractor is run on an entry point that re-exports a symbol from an ambient module, it's unable to resolve the ambient module, and thus throws an error.
Repro steps
rush rebuild -o api-extractor-scenariosambientModuletest scenario.Details
The problem seems to be in the TypeScript
getResolvedModulehelper. It doesn't seem to be able to resolve ambient modules. It's not clear to me if there's something wrong in my setup, if there's a bug ingetResolvedModule, or if API Extractor has to use some other TS compiler API to resolve ambient modules.Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractorversion?node -v)?