Closed

Description
Bug Report
π Search Terms
generic function call
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about generics
β― Playground Link
π» Code
type IfAny<T> = 0 extends (1 & T) ? true : never
declare function bool<T extends IfAny<T>>(value?: T): 'caught';
declare function bool<T>(value?: T): 'not caught';
declare function bool2<T extends {['gibberish']: T}>(value?: T): 'caught';
declare function bool2<T>(value?: T): 'not caught';
const A = bool(undefined); // caught ???
const B = bool2(undefined); // caught ???
const C = bool(); // caught ???
const D = bool2(); // caught ???
π Actual behavior
both implicit and explicit undefined
arguments seems to act like any
when used in a generic when the argument is optional. This behavior is not seen when the argument is required
π Expected behavior
undefined
shouldn't extend everything