Is there a way in typescript to define the type of a function (note: not an arrow function) in typescript?
I'm aware of the following method:
const MyFunctionCreator = (): MyFunction => {
return function(input) {
return "";
};
};
However, I am trying to set the type of a static function inside a class, so this is not ideal.
class MyClass {
static function(input) {
return "";
}
}
Is there a way in the example above to do something like:
class MyClass {
static myFunction: MyFunction(input) {
return "";
}
static myFunction(input) {
return "";
} as MyFunction
}
I can of course re-type the param/return types every time, but I wish to share types across my classes.