Imagine having a nodejs module where requiring it gives you a constructor function. Here's an example:
var Mod = require("modulename");
var mod = new Mod();
mod.method();
Now, I want to create a .d.ts declaration file that can be imported and utilized in this way:
import * as Mod from "mod";
let mod = new Mod();
mod.method();
Despite going through the TypeScript documentation, I am struggling to figure out how to properly define the .d.ts file. I've experimented with various combinations of class, interface, namespace, module, and export but haven't found a solution yet. Is it even possible to achieve what I described above? Any guidance would be greatly appreciated.