We had an Issue in redux-starter-kit where a user of the library had strictNullChecks disabled and one of our type tests was short-cicuiting, returning types for a different case.
This test should return the True-Parameter or the False-Parameter depending if the P parameter contains undefined or not.
This is the current code:
type IfMaybeUndefined<P, True, False> = [undefined] extends [P] ? True : False;
So I'm expecting both of these to return "yes":
IfMayBeUndefined<number, "no", "yes">
IfMayBeUndefined<number|undefined, "yes", "no">
Now I'm asking myself if there is another way to test this, even with strictNullChecks: false