diff --git a/index.ts b/index.ts index 1b19972..4a0e94f 100644 --- a/index.ts +++ b/index.ts @@ -172,6 +172,10 @@ function isNodeKindStringLiteral(value: ts.Node): value is ts.StringLiteral { return value && value.kind === ts.SyntaxKind.StringLiteral; } +function isNodeKindIdentifier(value: ts.Node): value is ts.Identifier { + return value && value.kind === ts.SyntaxKind.Identifier; +} + function isNodeKindExportDeclaration(value: ts.Node): value is ts.ExportDeclaration { return value && value.kind === ts.SyntaxKind.ExportDeclaration; } @@ -327,7 +331,7 @@ export default function generate(options: Options): Promise { processTree(sourceFile, function (node) { if (isNodeKindModuleDeclaration(node)) { const name = node.name; - if (isNodeKindStringLiteral(name)) { + if (isNodeKindStringLiteral(name) || isNodeKindIdentifier(name)) { declaredExternalModules.push(name.text); } }