1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(14,1): error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'.
Types of parameters 'x' and 'x' are incompatible.
Type '"foo"' is not assignable to type '"bar"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(15,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'.
Types of parameters 'x' and 'x' are incompatible.
Type '"bar"' is not assignable to type '"foo"'.
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts (2 errors) ====
function f(x: "foo"): number;
function f(x: "foo"): number {
return 0;
}
function g(x: "bar"): number;
function g(x: "bar"): number {
return 0;
}
let a = f;
let b = g;
a = b;
~
!!! error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type '"foo"' is not assignable to type '"bar"'.
b = a;
~
!!! error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type '"bar"' is not assignable to type '"foo"'.
|