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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
|
=== tests/cases/compiler/arrayBestCommonTypes.ts ===
module EmptyTypes {
>EmptyTypes : Symbol(EmptyTypes, Decl(arrayBestCommonTypes.ts, 0, 0))
interface iface { }
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
class base implements iface { }
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
class base2 implements iface { }
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 2, 35))
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
class derived extends base { }
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
class f {
>f : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
public voidIfAny(x: boolean, y?: boolean): number;
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 8, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 8, 36))
public voidIfAny(x: string, y?: boolean): number;
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 9, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 9, 35))
public voidIfAny(x: number, y?: boolean): number;
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 10, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 10, 35))
public voidIfAny(x: any, y = false): any { return null; }
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 11, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 11, 32))
public x() {
>x : Symbol(f.x, Decl(arrayBestCommonTypes.ts, 11, 65))
<number>(this.voidIfAny([4, 2][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
<number>(this.voidIfAny([4, 2, undefined][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([undefined, 2, 4][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([null, 2, 4][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
<number>(this.voidIfAny([2, 4, null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
<number>(this.voidIfAny([undefined, 4, null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny(['', "q"][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
<number>(this.voidIfAny(['', "q", undefined][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([undefined, "q", ''][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([null, "q", ''][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
<number>(this.voidIfAny(["q", '', null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
<number>(this.voidIfAny([undefined, '', null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([[3, 4], [null]][0][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 4, 34))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 7, 13), Decl(arrayBestCommonTypes.ts, 8, 58), Decl(arrayBestCommonTypes.ts, 9, 57), Decl(arrayBestCommonTypes.ts, 10, 57))
var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }];
>t1 : Symbol(t1, Decl(arrayBestCommonTypes.ts, 31, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 31, 21))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 31, 32))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 31, 50))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 31, 56))
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 31, 78))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 31, 84))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }];
>t2 : Symbol(t2, Decl(arrayBestCommonTypes.ts, 32, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 32, 21))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 32, 33))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 32, 51))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 32, 60))
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 32, 82))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 32, 92))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }];
>t3 : Symbol(t3, Decl(arrayBestCommonTypes.ts, 33, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 33, 21))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 33, 32))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 33, 50))
>undefined : Symbol(undefined)
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 33, 64))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 33, 83))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 33, 90))
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 3, 36))
var anyObj: any = null;
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
// Order matters here so test all the variants
var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }];
>a1 : Symbol(a1, Decl(arrayBestCommonTypes.ts, 37, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 37, 23))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 37, 29))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 37, 41))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 37, 49))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 37, 61))
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 37, 72))
var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }];
>a2 : Symbol(a2, Decl(arrayBestCommonTypes.ts, 38, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 38, 23))
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 38, 34))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 38, 46))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 38, 52))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 38, 64))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 38, 72))
var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }];
>a3 : Symbol(a3, Decl(arrayBestCommonTypes.ts, 39, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 39, 23))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 39, 29))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 39, 41))
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 35, 15))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 39, 52))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 39, 64))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 39, 72))
var ifaceObj: iface = null;
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 0, 19))
var baseObj = new base();
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 1, 23))
var base2Obj = new base2();
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 2, 35))
var b1 = [baseObj, base2Obj, ifaceObj];
>b1 : Symbol(b1, Decl(arrayBestCommonTypes.ts, 45, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
var b2 = [base2Obj, baseObj, ifaceObj];
>b2 : Symbol(b2, Decl(arrayBestCommonTypes.ts, 46, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
var b3 = [baseObj, ifaceObj, base2Obj];
>b3 : Symbol(b3, Decl(arrayBestCommonTypes.ts, 47, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
var b4 = [ifaceObj, baseObj, base2Obj];
>b4 : Symbol(b4, Decl(arrayBestCommonTypes.ts, 48, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 41, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 42, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 43, 15))
}
}
}
module NonEmptyTypes {
>NonEmptyTypes : Symbol(NonEmptyTypes, Decl(arrayBestCommonTypes.ts, 51, 1))
interface iface { x: string; }
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
>x : Symbol(iface.x, Decl(arrayBestCommonTypes.ts, 54, 21))
class base implements iface { x: string; y: string; }
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
>x : Symbol(base.x, Decl(arrayBestCommonTypes.ts, 55, 33))
>y : Symbol(base.y, Decl(arrayBestCommonTypes.ts, 55, 44))
class base2 implements iface { x: string; z: string; }
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 55, 57))
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
>x : Symbol(base2.x, Decl(arrayBestCommonTypes.ts, 56, 34))
>z : Symbol(base2.z, Decl(arrayBestCommonTypes.ts, 56, 45))
class derived extends base { a: string; }
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
>a : Symbol(derived.a, Decl(arrayBestCommonTypes.ts, 57, 32))
class f {
>f : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
public voidIfAny(x: boolean, y?: boolean): number;
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 61, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 61, 36))
public voidIfAny(x: string, y?: boolean): number;
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 62, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 62, 35))
public voidIfAny(x: number, y?: boolean): number;
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 63, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 63, 35))
public voidIfAny(x: any, y = false): any { return null; }
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 64, 25))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 64, 32))
public x() {
>x : Symbol(f.x, Decl(arrayBestCommonTypes.ts, 64, 65))
<number>(this.voidIfAny([4, 2][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
<number>(this.voidIfAny([4, 2, undefined][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([undefined, 2, 4][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([null, 2, 4][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
<number>(this.voidIfAny([2, 4, null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
<number>(this.voidIfAny([undefined, 4, null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny(['', "q"][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
<number>(this.voidIfAny(['', "q", undefined][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([undefined, "q", ''][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([null, "q", ''][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
<number>(this.voidIfAny(["q", '', null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
<number>(this.voidIfAny([undefined, '', null][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>undefined : Symbol(undefined)
<number>(this.voidIfAny([[3, 4], [null]][0][0]));
>this.voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
>this : Symbol(f, Decl(arrayBestCommonTypes.ts, 57, 45))
>voidIfAny : Symbol(f.voidIfAny, Decl(arrayBestCommonTypes.ts, 60, 13), Decl(arrayBestCommonTypes.ts, 61, 58), Decl(arrayBestCommonTypes.ts, 62, 57), Decl(arrayBestCommonTypes.ts, 63, 57))
var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }];
>t1 : Symbol(t1, Decl(arrayBestCommonTypes.ts, 84, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 84, 21))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 84, 32))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 84, 50))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 84, 56))
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 84, 78))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 84, 84))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }];
>t2 : Symbol(t2, Decl(arrayBestCommonTypes.ts, 85, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 85, 21))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 85, 33))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 85, 51))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 85, 60))
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 85, 82))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 85, 92))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }];
>t3 : Symbol(t3, Decl(arrayBestCommonTypes.ts, 86, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 86, 21))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 86, 32))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 86, 50))
>undefined : Symbol(undefined)
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 86, 64))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 86, 83))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 86, 90))
>derived : Symbol(derived, Decl(arrayBestCommonTypes.ts, 56, 58))
var anyObj: any = null;
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
// Order matters here so test all the variants
var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }];
>a1 : Symbol(a1, Decl(arrayBestCommonTypes.ts, 90, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 90, 23))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 90, 29))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 90, 41))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 90, 49))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 90, 61))
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 90, 72))
var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }];
>a2 : Symbol(a2, Decl(arrayBestCommonTypes.ts, 91, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 91, 23))
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 91, 34))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 91, 46))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 91, 52))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 91, 64))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 91, 72))
var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }];
>a3 : Symbol(a3, Decl(arrayBestCommonTypes.ts, 92, 15))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 92, 23))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 92, 29))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 92, 41))
>anyObj : Symbol(anyObj, Decl(arrayBestCommonTypes.ts, 88, 15))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 92, 52))
>x : Symbol(x, Decl(arrayBestCommonTypes.ts, 92, 64))
>y : Symbol(y, Decl(arrayBestCommonTypes.ts, 92, 72))
var ifaceObj: iface = null;
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
>iface : Symbol(iface, Decl(arrayBestCommonTypes.ts, 53, 22))
var baseObj = new base();
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
>base : Symbol(base, Decl(arrayBestCommonTypes.ts, 54, 34))
var base2Obj = new base2();
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
>base2 : Symbol(base2, Decl(arrayBestCommonTypes.ts, 55, 57))
var b1 = [baseObj, base2Obj, ifaceObj];
>b1 : Symbol(b1, Decl(arrayBestCommonTypes.ts, 98, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
var b2 = [base2Obj, baseObj, ifaceObj];
>b2 : Symbol(b2, Decl(arrayBestCommonTypes.ts, 99, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
var b3 = [baseObj, ifaceObj, base2Obj];
>b3 : Symbol(b3, Decl(arrayBestCommonTypes.ts, 100, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
var b4 = [ifaceObj, baseObj, base2Obj];
>b4 : Symbol(b4, Decl(arrayBestCommonTypes.ts, 101, 15))
>ifaceObj : Symbol(ifaceObj, Decl(arrayBestCommonTypes.ts, 94, 15))
>baseObj : Symbol(baseObj, Decl(arrayBestCommonTypes.ts, 95, 15))
>base2Obj : Symbol(base2Obj, Decl(arrayBestCommonTypes.ts, 96, 15))
}
}
}
|