I have a function like this:
function fn(variableFunction: (args?: String) => boolean) { //changing to args?: any works but this needs to be String
...
}
I want to be able to pass the following functions to the above function.
function something(arg: string) {
return true;
}
function something2() {
return true;
}
fn(something); //doesn't like this because arg in something is not optional (and I don't want to make it optional either)
fn(something2);
What changes can I make to fn to make it work for both the cases?