Skip to content

Commit ff4ffe5

Browse files
committed
[api-extractor] Fix ExportAnalyzer unable to resolve type import declaration with LiteralTypeNode argument
1 parent 6ce7f0f commit ff4ffe5

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

apps/api-extractor/src/analyzer/ExportAnalyzer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,12 @@ export class ExportAnalyzer {
264264
importOrExportDeclaration: ts.ImportDeclaration | ts.ExportDeclaration | ts.ImportTypeNode,
265265
moduleSpecifier: string
266266
): boolean {
267-
const specifier: ts.TypeNode | ts.Expression | undefined = ts.isImportTypeNode(importOrExportDeclaration)
267+
let specifier: ts.TypeNode | ts.Expression | undefined = ts.isImportTypeNode(importOrExportDeclaration)
268268
? importOrExportDeclaration.argument
269269
: importOrExportDeclaration.moduleSpecifier;
270+
if (specifier && ts.isLiteralTypeNode(specifier)) {
271+
specifier = specifier.literal;
272+
}
270273
const mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined =
271274
specifier && ts.isStringLiteralLike(specifier)
272275
? TypeScriptInternals.getModeForUsageLocation(

build-tests/api-extractor-scenarios/etc/bundlerModuleResolution/api-extractor-scenarios.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
55
```ts
66

7-
import { Foo } from './other';
8-
7+
// Warning: (ae-forgotten-export) The symbol "Foo" needs to be exported by the entry point index.d.ts
8+
//
99
// @public (undocumented)
1010
export const reexport: Foo;
1111

build-tests/api-extractor-scenarios/etc/bundlerModuleResolution/rollup.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Foo } from './other';
1+
declare class Foo {
2+
}
23

34
/**
45
* @public

0 commit comments

Comments
 (0)