Imagine having a declaration file called foo.d.ts
:
declare namespace foo {
interface Bar {
(): void;
}
}
declare var foo: foo.Bar;
export default foo;
Upon compilation:
import Foo from './foo';
Foo();
The result is:
"use strict";
var foo_1 = require('./foo');
foo_1["default"]();
However, the code won't execute as expected because foo_1
is being treated as an object with a property default
, not as a function. How can we modify it to have foo_1()
appear instead of foo_1["default"]()
?