-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
TypeScript Version: 3.1.0-dev.201xxxxx
Search Terms:
overload, type union
Code
function f(a: number): number;
function f(a: string): string;
function f(a: string | number): string | number {
return a;
}
function foo(value: string | number) {
f(value)
}
Expected behavior:
Should be valid.
Actual behavior:
Argument of type 'string | number' is not assignable to parameter of type 'string'.
Type 'number' is not assignable to type 'string'.
Metadata
Metadata
Assignees
Labels
No labels