When an argument is omitted from a function call, it will default to undefined
.
It is therefore redundant to explicitly pass an undefined
literal as the last argument.
function hasOptionalParam(a: number, b?: number) {
// ...
}
hasOptionalParam(1, undefined)
function hasOptionalParam(a: number, b?: number) {
// ...
}
hasOptionalParam(1)
hasOptionalParam(1, 2)