Closed as not planned
Description
π Search Terms
overload, multiple call signature
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about overloads
β― Playground Link
π» Code
interface Not{
(x: boolean): boolean;
(x: false): true;
(x: true): false;
(x: boolean): boolean;
}
declare var not:Not
const notAny = not(true as any) // true !?!?
// ^?
π Actual behavior
The type of notAny
is inferred as true
, the return type of the second overload call signature.
π Expected behavior
The type of notAny
should infer to boolean
, as the first applicable signature without assignment to any
(described as the expected behavior here)
Alternately the type of notAny
should infer to boolean
as the last signature (and thus the type ReturnType<Not>
).
Additional information about the issue
Variation of this issue originally reported in #59064.
Metadata
Metadata
Assignees
Labels
No labels