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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithOptionalParameters.ts ===
// call signatures in derived types must have the same or fewer optional parameters as the base type
interface Base {
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a: () => number;
>a : Symbol(Base.a, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 2, 16))
a2: (x?: number) => number;
>a2 : Symbol(Base.a2, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 3, 20))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 4, 9))
a3: (x: number) => number;
>a3 : Symbol(Base.a3, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 4, 31))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 5, 9))
a4: (x: number, y?: number) => number;
>a4 : Symbol(Base.a4, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 5, 30))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 6, 9))
>y : Symbol(y, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 6, 19))
a5: (x?: number, y?: number) => number;
>a5 : Symbol(Base.a5, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 6, 42))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 7, 9))
>y : Symbol(y, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 7, 20))
}
interface I1 extends Base {
>I1 : Symbol(I1, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 8, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a: () => number; // ok, same number of required params
>a : Symbol(I1.a, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 10, 27))
}
interface I2 extends Base {
>I2 : Symbol(I2, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 12, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a: (x?: number) => number; // ok, same number of required params
>a : Symbol(I2.a, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 14, 27))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 15, 8))
}
interface I3 extends Base {
>I3 : Symbol(I3, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 16, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a: (x: number) => number; // error, too many required params
>a : Symbol(I3.a, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 18, 27))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 19, 8))
}
interface I4 extends Base {
>I4 : Symbol(I4, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 20, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a2: () => number; // ok, same number of required params
>a2 : Symbol(I4.a2, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 23, 27))
}
interface I5 extends Base {
>I5 : Symbol(I5, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 25, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a2: (x?: number) => number; // ok, same number of required params
>a2 : Symbol(I5.a2, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 27, 27))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 28, 9))
}
interface I6 extends Base {
>I6 : Symbol(I6, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 29, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a2: (x: number) => number; // ok, same number of params
>a2 : Symbol(I6.a2, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 31, 27))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 32, 9))
}
interface I7 extends Base {
>I7 : Symbol(I7, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 33, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a3: () => number; // ok, fewer required params
>a3 : Symbol(I7.a3, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 36, 27))
}
interface I8 extends Base {
>I8 : Symbol(I8, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 38, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a3: (x?: number) => number; // ok, fewer required params
>a3 : Symbol(I8.a3, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 40, 27))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 41, 9))
}
interface I9 extends Base {
>I9 : Symbol(I9, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 42, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a3: (x: number) => number; // ok, same number of required params
>a3 : Symbol(I9.a3, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 44, 27))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 45, 9))
}
interface I10 extends Base {
>I10 : Symbol(I10, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 46, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a3: (x: number, y: number) => number; // error, too many required params
>a3 : Symbol(I10.a3, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 48, 28))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 49, 9))
>y : Symbol(y, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 49, 19))
}
interface I11 extends Base {
>I11 : Symbol(I11, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 50, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a4: () => number; // ok, fewer required params
>a4 : Symbol(I11.a4, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 53, 28))
}
interface I12 extends Base {
>I12 : Symbol(I12, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 55, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a4: (x?: number, y?: number) => number; // ok, fewer required params
>a4 : Symbol(I12.a4, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 57, 28))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 58, 9))
>y : Symbol(y, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 58, 20))
}
interface I13 extends Base {
>I13 : Symbol(I13, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 59, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a4: (x: number) => number; // ok, same number of required params
>a4 : Symbol(I13.a4, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 61, 28))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 62, 9))
}
interface I14 extends Base {
>I14 : Symbol(I14, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 63, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a4: (x: number, y: number) => number; // ok, same number of params
>a4 : Symbol(I14.a4, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 65, 28))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 66, 9))
>y : Symbol(y, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 66, 19))
}
interface I15 extends Base {
>I15 : Symbol(I15, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 67, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a5: () => number; // ok, fewer required params
>a5 : Symbol(I15.a5, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 70, 28))
}
interface I16 extends Base {
>I16 : Symbol(I16, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 72, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a5: (x?: number, y?: number) => number; // ok, fewer required params
>a5 : Symbol(I16.a5, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 74, 28))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 75, 9))
>y : Symbol(y, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 75, 20))
}
interface I17 extends Base {
>I17 : Symbol(I17, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 76, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a5: (x: number) => number; // ok, all present params match
>a5 : Symbol(I17.a5, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 78, 28))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 79, 9))
}
interface I18 extends Base {
>I18 : Symbol(I18, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 80, 1))
>Base : Symbol(Base, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 0, 0))
a5: (x: number, y: number) => number; // ok, same number of params
>a5 : Symbol(I18.a5, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 82, 28))
>x : Symbol(x, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 83, 9))
>y : Symbol(y, Decl(subtypingWithCallSignaturesWithOptionalParameters.ts, 83, 19))
}
|