Skip to content

[api-extractor] API Extractor cannot resolve ambient modules #3335

Description

@zelliott

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

  1. Clone https://github.com/zelliott/rushstack/tree/ambient-modules
  2. Run rush rebuild -o api-extractor-scenarios
  3. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions