mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Accepted baselines.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,5): error TS2322: Type 'string' is not assignable to type '(x: "hi") => number'.
|
||||
tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,37): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (1 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (2 errors) ====
|
||||
|
||||
var f: (x: 'hi') => number = ('hi') => { return 1; };
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '(x: "hi") => number'.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,7 +1,8 @@
|
||||
tests/cases/compiler/overloadOnConstInheritance2.ts(5,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'.
|
||||
Types of property 'addEventListener' are incompatible.
|
||||
Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'.
|
||||
Type '(x: "bar") => string' provides no match for the signature '(x: string): any'
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"bar"' is not assignable to type '"foo"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInheritance2.ts (1 errors) ====
|
||||
@@ -14,7 +15,8 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(5,11): error TS2430: Interfa
|
||||
!!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'.
|
||||
!!! error TS2430: Types of property 'addEventListener' are incompatible.
|
||||
!!! error TS2430: Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'.
|
||||
!!! error TS2430: Type '(x: "bar") => string' provides no match for the signature '(x: string): any'
|
||||
!!! error TS2430: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2430: Type '"bar"' is not assignable to type '"foo"'.
|
||||
addEventListener(x: 'bar'): string; // shouldn't need to redeclare the string overload
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstInheritance3.ts(4,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'.
|
||||
Types of property 'addEventListener' are incompatible.
|
||||
Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'.
|
||||
Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any'
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInheritance3.ts (1 errors) ====
|
||||
interface Base {
|
||||
addEventListener(x: string): any;
|
||||
}
|
||||
interface Deriver extends Base {
|
||||
~~~~~~~
|
||||
!!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'.
|
||||
!!! error TS2430: Types of property 'addEventListener' are incompatible.
|
||||
!!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'.
|
||||
!!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any'
|
||||
// shouldn't need to redeclare the string overload
|
||||
addEventListener(x: 'bar'): string;
|
||||
addEventListener(x: 'foo'): string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/overloadOnConstInheritance3.ts ===
|
||||
interface Base {
|
||||
>Base : Symbol(Base, Decl(overloadOnConstInheritance3.ts, 0, 0))
|
||||
|
||||
addEventListener(x: string): any;
|
||||
>addEventListener : Symbol(addEventListener, Decl(overloadOnConstInheritance3.ts, 0, 16))
|
||||
>x : Symbol(x, Decl(overloadOnConstInheritance3.ts, 1, 21))
|
||||
}
|
||||
interface Deriver extends Base {
|
||||
>Deriver : Symbol(Deriver, Decl(overloadOnConstInheritance3.ts, 2, 1))
|
||||
>Base : Symbol(Base, Decl(overloadOnConstInheritance3.ts, 0, 0))
|
||||
|
||||
// shouldn't need to redeclare the string overload
|
||||
addEventListener(x: 'bar'): string;
|
||||
>addEventListener : Symbol(addEventListener, Decl(overloadOnConstInheritance3.ts, 3, 32), Decl(overloadOnConstInheritance3.ts, 5, 39))
|
||||
>x : Symbol(x, Decl(overloadOnConstInheritance3.ts, 5, 21))
|
||||
|
||||
addEventListener(x: 'foo'): string;
|
||||
>addEventListener : Symbol(addEventListener, Decl(overloadOnConstInheritance3.ts, 3, 32), Decl(overloadOnConstInheritance3.ts, 5, 39))
|
||||
>x : Symbol(x, Decl(overloadOnConstInheritance3.ts, 6, 21))
|
||||
}
|
||||
|
||||
22
tests/baselines/reference/overloadOnConstInheritance3.types
Normal file
22
tests/baselines/reference/overloadOnConstInheritance3.types
Normal file
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/overloadOnConstInheritance3.ts ===
|
||||
interface Base {
|
||||
>Base : Base
|
||||
|
||||
addEventListener(x: string): any;
|
||||
>addEventListener : (x: string) => any
|
||||
>x : string
|
||||
}
|
||||
interface Deriver extends Base {
|
||||
>Deriver : Deriver
|
||||
>Base : Base
|
||||
|
||||
// shouldn't need to redeclare the string overload
|
||||
addEventListener(x: 'bar'): string;
|
||||
>addEventListener : { (x: "bar"): string; (x: "foo"): string; }
|
||||
>x : "bar"
|
||||
|
||||
addEventListener(x: 'foo'): string;
|
||||
>addEventListener : { (x: "bar"): string; (x: "foo"): string; }
|
||||
>x : "foo"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"bye"' is not assignable to type '"hi"'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type '"hi"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (1 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (3 errors) ====
|
||||
interface I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
}
|
||||
@@ -22,6 +28,14 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345
|
||||
var c: C;
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type '"bye"' is not assignable to type '"hi"'.
|
||||
c.x1(1, (x) => { return 1; } );
|
||||
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type '"hi"'.
|
||||
@@ -0,0 +1,37 @@
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"bye"' is not assignable to type '"hi"'.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(20,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type '"hi"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts (2 errors) ====
|
||||
interface I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
callback('hi');
|
||||
callback('bye');
|
||||
var hm = "hm";
|
||||
callback(hm);
|
||||
callback(1);
|
||||
}
|
||||
}
|
||||
|
||||
var c: C;
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type '"bye"' is not assignable to type '"hi"'.
|
||||
c.x1(1, (x: string) => { return 1; } );
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type '"hi"'.
|
||||
@@ -1,73 +0,0 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts ===
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(overloadOnConstNoStringImplementation2.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoStringImplementation2.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation2.ts, 1, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 1, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 1, 29))
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : Symbol(C, Decl(overloadOnConstNoStringImplementation2.ts, 2, 1))
|
||||
>I : Symbol(I, Decl(overloadOnConstNoStringImplementation2.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation2.ts, 5, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 5, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 5, 29))
|
||||
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation2.ts, 6, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 6, 29))
|
||||
|
||||
callback('hi');
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
|
||||
callback('bye');
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
|
||||
var hm = "hm";
|
||||
>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation2.ts, 9, 11))
|
||||
|
||||
callback(hm);
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation2.ts, 9, 11))
|
||||
|
||||
callback(1);
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
}
|
||||
}
|
||||
|
||||
var c: C;
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>C : Symbol(C, Decl(overloadOnConstNoStringImplementation2.ts, 2, 1))
|
||||
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 16, 9))
|
||||
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 17, 9))
|
||||
|
||||
c.x1(1, (x: string) => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 18, 9))
|
||||
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 19, 9))
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts ===
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : C
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: any) => number
|
||||
>x : any
|
||||
|
||||
callback('hi');
|
||||
>callback('hi') : number
|
||||
>callback : (x: any) => number
|
||||
>'hi' : string
|
||||
|
||||
callback('bye');
|
||||
>callback('bye') : number
|
||||
>callback : (x: any) => number
|
||||
>'bye' : string
|
||||
|
||||
var hm = "hm";
|
||||
>hm : string
|
||||
>"hm" : string
|
||||
|
||||
callback(hm);
|
||||
>callback(hm) : number
|
||||
>callback : (x: any) => number
|
||||
>hm : string
|
||||
|
||||
callback(1);
|
||||
>callback(1) : number
|
||||
>callback : (x: any) => number
|
||||
>1 : number
|
||||
}
|
||||
}
|
||||
|
||||
var c: C;
|
||||
>c : C
|
||||
>C : C
|
||||
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
>c.x1(1, (x: 'hi') => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: 'hi') => { return 1; } : (x: "hi") => number
|
||||
>x : "hi"
|
||||
>1 : number
|
||||
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
>c.x1(1, (x: 'bye') => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: 'bye') => { return 1; } : (x: "bye") => number
|
||||
>x : "bye"
|
||||
>1 : number
|
||||
|
||||
c.x1(1, (x: string) => { return 1; } );
|
||||
>c.x1(1, (x: string) => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: string) => { return 1; } : (x: string) => number
|
||||
>x : string
|
||||
>1 : number
|
||||
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
>c.x1(1, (x: number) => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: number) => { return 1; } : (x: number) => number
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(15,1): error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"bar"' is not assignable to type '"foo"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(16,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"foo"' is not assignable to type '"bar"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts (2 errors) ====
|
||||
|
||||
function f(x: "foo"): number;
|
||||
function f(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
function g(x: string): 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 '"bar"' is not assignable to type '"foo"'.
|
||||
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 '"foo"' is not assignable to type '"bar"'.
|
||||
@@ -1,40 +0,0 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability01.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 11))
|
||||
|
||||
function f(x: string): number {
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability01.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 2, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability01.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 11))
|
||||
|
||||
function g(x: string): number {
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability01.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 7, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability01.ts, 11, 3))
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability01.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 29))
|
||||
|
||||
let b = g;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability01.ts, 12, 3))
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability01.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 29))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability01.ts, 11, 3))
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability01.ts, 12, 3))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability01.ts, 12, 3))
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability01.ts, 11, 3))
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function f(x: string): number {
|
||||
>f : (x: "foo") => number
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : (x: "bar") => number
|
||||
>x : "bar"
|
||||
|
||||
function g(x: string): number {
|
||||
>g : (x: "bar") => number
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : (x: "foo") => number
|
||||
>f : (x: "foo") => number
|
||||
|
||||
let b = g;
|
||||
>b : (x: "bar") => number
|
||||
>g : (x: "bar") => number
|
||||
|
||||
a = b;
|
||||
>a = b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
|
||||
b = a;
|
||||
>b = a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(15,1): error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"bar"' is not assignable to type '"foo"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(16,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"foo"' is not assignable to type '"bar"'.
|
||||
|
||||
|
||||
==== 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 '"bar"' is not assignable to type '"foo"'.
|
||||
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 '"foo"' is not assignable to type '"bar"'.
|
||||
@@ -1,40 +0,0 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability02.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 11))
|
||||
|
||||
function f(x: "foo"): number {
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability02.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 2, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability02.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 11))
|
||||
|
||||
function g(x: "bar"): number {
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability02.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 7, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability02.ts, 11, 3))
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability02.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 29))
|
||||
|
||||
let b = g;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability02.ts, 12, 3))
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability02.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 29))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability02.ts, 11, 3))
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability02.ts, 12, 3))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability02.ts, 12, 3))
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability02.ts, 11, 3))
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function f(x: "foo"): number {
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : (x: "bar") => number
|
||||
>x : "bar"
|
||||
|
||||
function g(x: "bar"): number {
|
||||
>g : (x: "bar") => number
|
||||
>x : "bar"
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : (x: "foo") => number
|
||||
>f : (x: "foo") => number
|
||||
|
||||
let b = g;
|
||||
>b : (x: "bar") => number
|
||||
>g : (x: "bar") => number
|
||||
|
||||
a = b;
|
||||
>a = b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
|
||||
b = a;
|
||||
>b = a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts(16,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '{ (x: "foo"): number; (x: string): number; }'.
|
||||
Type '(x: "foo") => number' provides no match for the signature '(x: string): number'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts (1 errors) ====
|
||||
|
||||
function f(x: "foo"): number;
|
||||
function f(x: string): number;
|
||||
function f(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
function g(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
let b = g;
|
||||
|
||||
a = b;
|
||||
~
|
||||
!!! error TS2322: Type '(x: "foo") => number' is not assignable to type '{ (x: "foo"): number; (x: string): number; }'.
|
||||
!!! error TS2322: Type '(x: "foo") => number' provides no match for the signature '(x: string): number'
|
||||
b = a;
|
||||
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 11))
|
||||
|
||||
function f(x: string): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 11))
|
||||
|
||||
function f(x: string): number {
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 3, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability05.ts, 5, 1), Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 11))
|
||||
|
||||
function g(x: string): number {
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability05.ts, 5, 1), Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability05.ts, 8, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability05.ts, 12, 3))
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability05.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability05.ts, 1, 29), Decl(stringLiteralTypesOverloadAssignability05.ts, 2, 30))
|
||||
|
||||
let b = g;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability05.ts, 13, 3))
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability05.ts, 5, 1), Decl(stringLiteralTypesOverloadAssignability05.ts, 7, 29))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability05.ts, 12, 3))
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability05.ts, 13, 3))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability05.ts, 13, 3))
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability05.ts, 12, 3))
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : { (x: "foo"): number; (x: string): number; }
|
||||
>x : "foo"
|
||||
|
||||
function f(x: string): number;
|
||||
>f : { (x: "foo"): number; (x: string): number; }
|
||||
>x : string
|
||||
|
||||
function f(x: string): number {
|
||||
>f : { (x: "foo"): number; (x: string): number; }
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
>g : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function g(x: string): number {
|
||||
>g : (x: "foo") => number
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : { (x: "foo"): number; (x: string): number; }
|
||||
>f : { (x: "foo"): number; (x: string): number; }
|
||||
|
||||
let b = g;
|
||||
>b : (x: "foo") => number
|
||||
>g : (x: "foo") => number
|
||||
|
||||
a = b;
|
||||
>a = b : (x: "foo") => number
|
||||
>a : { (x: "foo"): number; (x: string): number; }
|
||||
>b : (x: "foo") => number
|
||||
|
||||
b = a;
|
||||
>b = a : { (x: "foo"): number; (x: string): number; }
|
||||
>b : (x: "foo") => number
|
||||
>a : { (x: "foo"): number; (x: string): number; }
|
||||
|
||||
Reference in New Issue
Block a user