This is already invalid:
function foo1(arg1?: number, arg2: number) {}
function foo1(arg1: number | undefined, arg2: number) {} foo1(undefined,1);
https://www.typescriptlang.org/play?#code/AQMwrgdgxgLglgewqB...
This conflation of "optional" and "undefined-able" is more obvious in interfaces. This is why TypeScript added the `exactOptionalPropertyTypes` option:
https://www.typescriptlang.org/tsconfig#exactOptionalPropert...
Sometimes "is not defined" needs to be treated differently than "is set to undefined"
This is already invalid:
In that case you have to use But other than that what is the use case?