TypeScript/tests/cases/compiler/declarationEmitForModuleImportingModuleAugmentationRetainsImport.ts
Wesley Wigham 141ee01c8c
Retain imports in declaration emit if they augment an export of the importing file (#37820)
* Retain imports in declaration emit if they augment an export of the importing file

* (sp)

* Check that a merge occurs, just because
2020-04-13 12:31:14 -07:00

20 lines
557 B
TypeScript

// @declaration: true
// @filename: child1.ts
import { ParentThing } from './parent';
declare module './parent' {
interface ParentThing {
add: (a: number, b: number) => number;
}
}
export function child1(prototype: ParentThing) {
prototype.add = (a: number, b: number) => a + b;
}
// @filename: parent.ts
import { child1 } from './child1'; // this import should still exist in some form in the output, since it augments this module
export class ParentThing implements ParentThing {}
child1(ParentThing.prototype);