If a parameter is marked as optional with ?, it means that passing undefined
is acceptable. If a parameter is marked as optional by providing an initializer,
it communicates to readers that if not provided (or set to undefined) the
default will be used. It doesn't make sense to use both modifiers.
function test(a?: number = 0) {}Fix: Remove the question mark or the initializer
Remove the question mark if the default better communicates your intent, or remove the initializer:
function test(a: number = 0) {}
// or
function test(a?: number) {}Related: TS1016