Skip to content

Commit

Permalink
fix: Omit global namespace from name generation
Browse files Browse the repository at this point in the history
  • Loading branch information
WoH committed Dec 28, 2023
1 parent 9c46f2a commit 4e2395a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/cli/src/metadataGeneration/typeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,15 @@ export class TypeResolver {

let actNode = oneDeclaration.parent;
let isFirst = true;
const isGlobalDeclaration = (mod: ts.ModuleDeclaration) => mod.name.kind === ts.SyntaxKind.Identifier && mod.name.text === 'global';

while (!ts.isSourceFile(actNode)) {
if (!(isFirst && ts.isEnumDeclaration(actNode)) && !ts.isModuleBlock(actNode)) {
if (ts.isModuleDeclaration(actNode)) {
const moduleName = actNode.name.text;
name = `${moduleName}.${name}`;
if (!isGlobalDeclaration(actNode)) {
const moduleName = actNode.name.text;
name = `${moduleName}.${name}`;
}
} else {
throw new GenerateMetadataError(`This node kind is unknown: ${actNode.kind}`, type);
}
Expand Down

0 comments on commit 4e2395a

Please sign in to comment.