const Foo: new () => any = class {
constructor() {}
bar(): string {
return ‘Hello World!’;
}
};
const instance = new Foo();
below I want to replace any cause my config not allows any
new () => any
How can I define Foo()'s result ?
const Foo: new () => any = class {
constructor() {}
bar(): string {
return ‘Hello World!’;
}
};
const instance = new Foo();
below I want to replace any cause my config not allows any
new () => any
How can I define Foo()'s result ?
I suggest defining an interface named Foo
to correspond to the instances that the class expression named Foo
creates:
interface Foo {
bar(): string;
}
Then you can declare Foo
as type new () => Foo
:
const Foo: new () => Foo = class {
constructor() { }
bar(): string {
return 'Hello World!';
}
};
Hope that helps; good luck!