Skip to content

[api-extractor] Unable to analyze the export #1972

Open
@miguelramos

Description

@miguelramos

Is this a feature or a bug?

  • Feature
  • [x ] Bug

Please describe the actual behavior.
Try to export a typescript type importing from one file and exported from other file(index).

Log Stack:

 Error: Internal Error: Unable to analyze the export "Predicate" in
/Users/miguelramos/Public/workspace/prz-kit/dist/packages/support/@types/helpers.d.ts

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
    at ExportAnalyzer._getExportOfAstModule (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:643:13)
    at ExportAnalyzer._getExportOfSpecifierAstModule (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:631:39)
    at ExportAnalyzer._tryMatchExportDeclaration (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:448:21)
    at ExportAnalyzer.fetchReferencedAstEntity (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:360:35)
    at ExportAnalyzer._tryGetExportOfAstModule (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:678:26)
    at ExportAnalyzer._getExportOfAstModule (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:637:51)
    at /Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:322:53
    at Map.forEach (<anonymous>)
    at ExportAnalyzer._collectAllExportsRecursive (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:313:40)
    at ExportAnalyzer.fetchAstModuleExportInfo (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/ExportAnalyzer.ts:253:12)
    at AstSymbolTable.fetchAstModuleExportInfo (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/analyzer/AstSymbolTable.ts:127:33)
    at Collector.analyze (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/collector/Collector.ts:233:74)
    at Function.invoke (/Users/miguelramos/Public/workspace/prz-kit/node_modules/@microsoft/api-extractor/src/api/Extractor.ts:222:15)
    at Object.<anonymous> (/Users/miguelramos/Public/workspace/prz-kit/tools/packages/gulp/build-tasks-gulp.ts:127:56)
    at step (/Users/miguelramos/Public/workspace/prz-kit/tools/packages/gulp/build-tasks-gulp.ts:34:23)
    at Object.next (/Users/miguelramos/Public/workspace/prz-kit/tools/packages/gulp/build-tasks-gulp.ts:15:53)

If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate.
My files:

helpers.ts

/**
 * A type which represents a function that returns a Boolean value.
 *
 * @example
 * ```ts-no-run
 * const isGreaterThanTen: Predicate = (num: number) => num > 10;
 * isGreaterThanTen(2); // false
 * isGreaterThanTen(20); // true
 * ```
 * @public
 */

export type Predicate = <T>(value: T) => boolean;

index.ts

export { Predicate } from './helpers';

What is the expected behavior?
Type being on dts file.

If this is a bug, please provide the tool version, Node.js version, and OS.

  • Tool: api-extractor
  • Tool Version: 7.8.12
  • Node Version: v12.18.1
    • Is this a LTS version? Yes
    • Have you tested on a LTS version? Yes
  • OS: OSX Catalina 10.15.5 (19F101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoWe can't proceed because we need a better repro or an answer to a question

    Type

    No type

    Projects

    Status

    AE/AD

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions