Description
I'm having a specific typings file which has a modern shape like this.
// something.d.ts
declare function something(...): ...;
declare namespace something {
interface A { ... }
interface B { ... }
}
export = something;
export as namespace something;
I'm trying to consume this module in file which is not a module, so the official module augmentation doesn't work. My task would be to add another function to the something
namespace root, and another to the A
interface.
I've tried to utilize namespace merging, but it seems like it's not working because instead of merging it thinks that my declaration is the only one, so the original stuff coming from the typings file is not visible at all.
// myGlobalFile.ts
declare namespace something {
function extraFunction();
interface A {
extraFunctionOnA();
}
}
As far as the interface augmentation goes, I've also tried the silly syntax like
// myGlobalFile.ts
interface something.A {
extraFunctionOnA();
}
But of course that's a syntax error so no way it could work, but it represents half of my goal quite well.
I've put this as a question onto SO but I got no answer nor a comment until now. (https://stackoverflow.com/questions/45505975/how-to-augment-a-module-in-global-context)
TypeScript Version: 2.4.2
Expected behavior:
The module can be augmented from global scope.
Actual behavior:
The augmentation actually kind of overwrites the entire module namespace.