When working with ES5 code, I encountered an error that I cannot seem to resolve. Despite following the language spec and checking my TypeScript version 1.7.5, I still can't figure out why this error is occurring.
Error TS2349: Cannot invoke an expression whose type lacks a call signature.
a.js (ES5 ambient module with default export)
function myfunc() {
return "hello";
}
module.exports = myfunc;
a.d.ts
declare module "test" {
export default function (): string;
}
b.ts
import test = require("test");
const app = test();
b.js (generated ES5):
var test = require("test");
var app = test()