diff --git a/src/transform/ExportsFixer.ts b/src/transform/ExportsFixer.ts index 40055e3..6553105 100644 --- a/src/transform/ExportsFixer.ts +++ b/src/transform/ExportsFixer.ts @@ -31,6 +31,7 @@ export class ExportsFixer { const exportedName = e.name.text; const localName = e.propertyName?.text ?? e.name.text; const kind = types.some(node => node.getText() === localName) && !values.some(node => node.getText() === localName) ? 'type' as const : 'value' as const; + this.DEBUG && (console.log(`export ${localName} as ${exportedName} is a ${kind}`)); return { exportedName, localName, @@ -96,6 +97,10 @@ export class ExportsFixer { continue; } if (ts.isModuleDeclaration(statement)) { + if (statement.name && ts.isIdentifier(statement.name)) { + this.DEBUG && console.log(`${statement.name.getFullText()} is a value (from module declaration)`); + values.push(statement.name); + } recurseInto(statement.getChildren()); continue; } diff --git a/tests/testcases/issue-284/expected.d.ts b/tests/testcases/issue-284/expected.d.ts new file mode 100644 index 0000000..1486ccf --- /dev/null +++ b/tests/testcases/issue-284/expected.d.ts @@ -0,0 +1,7 @@ +interface MyInterface { + a: string; +} +declare namespace MyInterface { + export const b: string; +} +export { MyInterface }; diff --git a/tests/testcases/issue-284/index.d.ts b/tests/testcases/issue-284/index.d.ts new file mode 100644 index 0000000..ff35cea --- /dev/null +++ b/tests/testcases/issue-284/index.d.ts @@ -0,0 +1,7 @@ +export interface MyInterface { + a: string; +} + +export namespace MyInterface { + export const b: string; +}