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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts ===
// void returning call signatures can be assigned a non-void returning call signature that otherwise matches
interface T {
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures.ts, 0, 0))
(x: number): void;
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 3, 5))
}
var t: T;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures.ts, 0, 0))
var a: { (x: number): void };
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 6, 10))
t = a;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
a = t;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
interface S {
>S : Symbol(S, Decl(assignmentCompatWithCallSignatures.ts, 9, 6))
(x: number): string;
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 12, 5))
}
var s: S;
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures.ts, 14, 3))
>S : Symbol(S, Decl(assignmentCompatWithCallSignatures.ts, 9, 6))
var a2: { (x: number): string };
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures.ts, 15, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 15, 11))
t = s;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures.ts, 14, 3))
t = a2;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures.ts, 15, 3))
a = s;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures.ts, 14, 3))
a = a2;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures.ts, 15, 3))
t = <T>(x: T) => 1;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures.ts, 21, 5))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 21, 8))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures.ts, 21, 5))
t = () => 1;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
t = function (x: number) { return ''; }
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 23, 14))
a = <T>(x: T) => 1;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures.ts, 24, 5))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 24, 8))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures.ts, 24, 5))
a = () => 1;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
a = function (x: number) { return ''; }
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 26, 14))
interface S2 {
>S2 : Symbol(S2, Decl(assignmentCompatWithCallSignatures.ts, 26, 39))
(x: string): void;
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 29, 5))
}
var s2: S2;
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures.ts, 31, 3))
>S2 : Symbol(S2, Decl(assignmentCompatWithCallSignatures.ts, 26, 39))
var a3: { (x: string): void };
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures.ts, 32, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 32, 11))
// these are errors
t = s2;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures.ts, 31, 3))
t = a3;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures.ts, 32, 3))
t = (x: string) => 1;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 36, 5))
t = function (x: string) { return ''; }
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures.ts, 5, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 37, 14))
a = s2;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures.ts, 31, 3))
a = a3;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures.ts, 32, 3))
a = (x: string) => 1;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 40, 5))
a = function (x: string) { return ''; }
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures.ts, 6, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures.ts, 41, 14))
|