I have a function which takes four parameters, among which the 1st parameter is required, the 2nd & 3rd are optional, the 4th has a default value:
class MyClass {
static myFunc(param1: string, param2? : string, param3? : string, param4:boolean=true)
{
...
}
}
In my caller, I would like to provide the value of 1st parameter and override the 4th boolean. How to do that? I can't do MyClass.myFunc("foo", false)
. Should I re-design the function signature? What is the convention in TypeScript to have a function like that?