typescript optional callback function as parameter code example
Example: typescript make function argument optional
function multiply(a: number, b: number, c?: number): number {
if (typeof c !== 'undefined') {
return a * b * c;
}
return a * b;
}