In my TypeScript code, I have the following scenario:
export const makeMyClass = function(a: string, b: boolean){
const MyClass = function(){
};
MyClass.prototype.foo = function(){};
MyClass.prototype.bar = function(){};
return MyClass;
}
I am struggling to translate the code inside the exported factory function into TypeScript.
When attempting this approach:
export const makeMyClass = function(a: string, b: boolean): MyClass {
class MyClass {
}
// ...
return MyClass;
}
TypeScript gives an error stating that it cannot locate the name 'MyClass'. Let's assume that I need to utilize the exported closure makeMyClass
for this question's purpose.