I'm encountering an issue with this TypeScript code
import Conf = require('conf');
const config = new Conf();
The Problem: the expression is not constructable and the imported module lacks construct signatures
It's puzzling because the module has a default export of a class named 'Conf' with a 'constructor' method.
Tried Solution: I attempted the following with explanation to follow
const config = Conf;
config.constructor();
I theorized that maybe the problem stemmed from 'Conf' exporting the class itself, requiring me to assign it to a variable and then call its methods directly as shown above, but this approach strikes me as odd.
Why doesn't the usual 'new' syntax function here?
References Pkg for your perusal: https://www.npmjs.com/package/conf
Update 1:
The conf package presents the example in this manner:
const Conf = require('conf');
const config = new Conf();
Please bear in mind that in typescript, the standard import syntax for commonJS should be utilized, which explains my usage of it:
import Conf = require('conf');
Src: https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require
Personally, I don't think the import syntax is causing the problem here.
Update 2
Turns out it was indeed an import syntax issue haha. Kudos to Alex for pointing that out.