We have the following TestComponent.ts TypeScript class:
01: import TestVectorLayer from \'./TestVectorLayer\'
02:
03: export class TestCompone
David answer is great, but if you care just about quickly making it compile (for example because you are migrating from JS to TS) then you can simply put any there to shut up complaining compiler.
TS file:
const TestConstructorFunction = function (this: any, a: any, b: any) {
this.a = a;
this.b = b;
};
let test1 = new (TestConstructorFunction as any)(1, 2);
compiles to this JS file:
var TestConstructor = function (a, b) {
this.a = a;
this.b = b;
};
var test1 = new TestConstructor(1, 2);
Just pay attention to not make this mistake:
TS file:
// wrong!
let test2 = new (TestConstructorFunction(1, 2) as any);
JS result:
// wrong!
var test2 = new (TestConstructor(1, 2));
and this is wrong. You'll get TypeError: TestConstructor(...) is not a constructor error at runtime.