Skip to content

[api-extractor] Items with non-inline exports have incorrect canonical references #3523

Description

Summary

Api extractor emits incorrect canonical reference navigation paths for api items that don't have inline exports. Items that have inline exports and items that export items via export { A, B, C } should all have the same canonical reference paths.

Repro steps

Run API extractor on the following declaration file:

class A {
	foo: string;
}

interface B {
	bar: A;
}

export { A, B };

The output api json shows B#bars canonical reference as a local member instead of an exported member:

Expected result:

B#bar's canonical reference is <packageName>!A:class

Actual result:

B#bar's canonical reference is <packageName>!~A:class

Details

After some investigating the issue is most likely caused by some code within DeclarationReferenceGenerator.

Zulip Chat

Standard questions

Question Answer
@microsoft/api-extractor version? 7.28.3
Operating system? macOS
API Extractor scenario? docs (.api.json)
Would you consider contributing a PR? Yes
TypeScript compiler version? 4.7.4
Node.js version (node -v)? 16.13.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    AE/AD

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions