1{ 2 "type": "Program", 3 "statements": [ 4 { 5 "type": "VariableDeclaration", 6 "declarations": [ 7 { 8 "type": "VariableDeclarator", 9 "id": { 10 "type": "Identifier", 11 "name": "a", 12 "decorators": [], 13 "loc": { 14 "start": { 15 "line": 17, 16 "column": 5 17 }, 18 "end": { 19 "line": 17, 20 "column": 6 21 } 22 } 23 }, 24 "init": { 25 "type": "ObjectExpression", 26 "properties": [], 27 "loc": { 28 "start": { 29 "line": 17, 30 "column": 9 31 }, 32 "end": { 33 "line": 17, 34 "column": 11 35 } 36 } 37 }, 38 "loc": { 39 "start": { 40 "line": 17, 41 "column": 5 42 }, 43 "end": { 44 "line": 17, 45 "column": 11 46 } 47 } 48 } 49 ], 50 "kind": "var", 51 "loc": { 52 "start": { 53 "line": 17, 54 "column": 1 55 }, 56 "end": { 57 "line": 17, 58 "column": 12 59 } 60 } 61 }, 62 { 63 "type": "VariableDeclaration", 64 "declarations": [ 65 { 66 "type": "VariableDeclarator", 67 "id": { 68 "type": "Identifier", 69 "name": "b", 70 "typeAnnotation": { 71 "type": "TSNumberKeyword", 72 "loc": { 73 "start": { 74 "line": 18, 75 "column": 8 76 }, 77 "end": { 78 "line": 18, 79 "column": 14 80 } 81 } 82 }, 83 "decorators": [], 84 "loc": { 85 "start": { 86 "line": 18, 87 "column": 5 88 }, 89 "end": { 90 "line": 18, 91 "column": 6 92 } 93 } 94 }, 95 "init": null, 96 "loc": { 97 "start": { 98 "line": 18, 99 "column": 5 100 }, 101 "end": { 102 "line": 18, 103 "column": 6 104 } 105 } 106 } 107 ], 108 "kind": "var", 109 "loc": { 110 "start": { 111 "line": 18, 112 "column": 1 113 }, 114 "end": { 115 "line": 18, 116 "column": 15 117 } 118 } 119 }, 120 { 121 "type": "VariableDeclaration", 122 "declarations": [ 123 { 124 "type": "VariableDeclarator", 125 "id": { 126 "type": "Identifier", 127 "name": "c", 128 "typeAnnotation": { 129 "type": "TSStringKeyword", 130 "loc": { 131 "start": { 132 "line": 19, 133 "column": 7 134 }, 135 "end": { 136 "line": 19, 137 "column": 13 138 } 139 } 140 }, 141 "decorators": [], 142 "loc": { 143 "start": { 144 "line": 19, 145 "column": 5 146 }, 147 "end": { 148 "line": 19, 149 "column": 6 150 } 151 } 152 }, 153 "init": null, 154 "loc": { 155 "start": { 156 "line": 19, 157 "column": 5 158 }, 159 "end": { 160 "line": 19, 161 "column": 6 162 } 163 } 164 } 165 ], 166 "kind": "var", 167 "loc": { 168 "start": { 169 "line": 19, 170 "column": 1 171 }, 172 "end": { 173 "line": 19, 174 "column": 14 175 } 176 } 177 }, 178 { 179 "type": "VariableDeclaration", 180 "declarations": [ 181 { 182 "type": "VariableDeclarator", 183 "id": { 184 "type": "Identifier", 185 "name": "d", 186 "decorators": [], 187 "loc": { 188 "start": { 189 "line": 20, 190 "column": 5 191 }, 192 "end": { 193 "line": 20, 194 "column": 6 195 } 196 } 197 }, 198 "init": { 199 "type": "ArrayExpression", 200 "elements": [], 201 "loc": { 202 "start": { 203 "line": 20, 204 "column": 9 205 }, 206 "end": { 207 "line": 20, 208 "column": 11 209 } 210 } 211 }, 212 "loc": { 213 "start": { 214 "line": 20, 215 "column": 5 216 }, 217 "end": { 218 "line": 20, 219 "column": 11 220 } 221 } 222 } 223 ], 224 "kind": "var", 225 "loc": { 226 "start": { 227 "line": 20, 228 "column": 1 229 }, 230 "end": { 231 "line": 20, 232 "column": 12 233 } 234 } 235 }, 236 { 237 "type": "VariableDeclaration", 238 "declarations": [ 239 { 240 "type": "VariableDeclarator", 241 "id": { 242 "type": "Identifier", 243 "name": "e", 244 "decorators": [], 245 "loc": { 246 "start": { 247 "line": 21, 248 "column": 5 249 }, 250 "end": { 251 "line": 21, 252 "column": 6 253 } 254 } 255 }, 256 "init": { 257 "type": "TSAsExpression", 258 "expression": { 259 "type": "ArrayExpression", 260 "elements": [ 261 { 262 "type": "StringLiteral", 263 "value": "foo", 264 "loc": { 265 "start": { 266 "line": 21, 267 "column": 10 268 }, 269 "end": { 270 "line": 21, 271 "column": 15 272 } 273 } 274 }, 275 { 276 "type": "NumberLiteral", 277 "value": 5, 278 "loc": { 279 "start": { 280 "line": 21, 281 "column": 17 282 }, 283 "end": { 284 "line": 21, 285 "column": 18 286 } 287 } 288 } 289 ], 290 "loc": { 291 "start": { 292 "line": 21, 293 "column": 9 294 }, 295 "end": { 296 "line": 21, 297 "column": 19 298 } 299 } 300 }, 301 "typeAnnotation": { 302 "type": "TSTypeReference", 303 "typeName": { 304 "type": "Identifier", 305 "name": "const", 306 "decorators": [], 307 "loc": { 308 "start": { 309 "line": 21, 310 "column": 23 311 }, 312 "end": { 313 "line": 21, 314 "column": 28 315 } 316 } 317 }, 318 "loc": { 319 "start": { 320 "line": 21, 321 "column": 23 322 }, 323 "end": { 324 "line": 21, 325 "column": 28 326 } 327 } 328 }, 329 "loc": { 330 "start": { 331 "line": 21, 332 "column": 9 333 }, 334 "end": { 335 "line": 21, 336 "column": 29 337 } 338 } 339 }, 340 "loc": { 341 "start": { 342 "line": 21, 343 "column": 5 344 }, 345 "end": { 346 "line": 21, 347 "column": 29 348 } 349 } 350 } 351 ], 352 "kind": "var", 353 "loc": { 354 "start": { 355 "line": 21, 356 "column": 1 357 }, 358 "end": { 359 "line": 21, 360 "column": 29 361 } 362 } 363 }, 364 { 365 "type": "ExpressionStatement", 366 "expression": { 367 "type": "AssignmentExpression", 368 "operator": "=", 369 "left": { 370 "type": "ArrayPattern", 371 "elements": [ 372 { 373 "type": "Identifier", 374 "name": "a", 375 "decorators": [], 376 "loc": { 377 "start": { 378 "line": 22, 379 "column": 2 380 }, 381 "end": { 382 "line": 22, 383 "column": 3 384 } 385 } 386 }, 387 { 388 "type": "AssignmentPattern", 389 "left": { 390 "type": "ArrayPattern", 391 "elements": [ 392 { 393 "type": "Identifier", 394 "name": "b", 395 "decorators": [], 396 "loc": { 397 "start": { 398 "line": 22, 399 "column": 6 400 }, 401 "end": { 402 "line": 22, 403 "column": 7 404 } 405 } 406 }, 407 { 408 "type": "OmittedExpression", 409 "loc": { 410 "start": { 411 "line": 22, 412 "column": 9 413 }, 414 "end": { 415 "line": 22, 416 "column": 10 417 } 418 } 419 }, 420 { 421 "type": "AssignmentPattern", 422 "left": { 423 "type": "Identifier", 424 "name": "c", 425 "decorators": [], 426 "loc": { 427 "start": { 428 "line": 22, 429 "column": 11 430 }, 431 "end": { 432 "line": 22, 433 "column": 12 434 } 435 } 436 }, 437 "right": { 438 "type": "StringLiteral", 439 "value": "bar", 440 "loc": { 441 "start": { 442 "line": 22, 443 "column": 15 444 }, 445 "end": { 446 "line": 22, 447 "column": 20 448 } 449 } 450 }, 451 "loc": { 452 "start": { 453 "line": 22, 454 "column": 11 455 }, 456 "end": { 457 "line": 22, 458 "column": 20 459 } 460 } 461 } 462 ], 463 "loc": { 464 "start": { 465 "line": 22, 466 "column": 5 467 }, 468 "end": { 469 "line": 22, 470 "column": 21 471 } 472 } 473 }, 474 "right": { 475 "type": "Identifier", 476 "name": "e", 477 "decorators": [], 478 "loc": { 479 "start": { 480 "line": 22, 481 "column": 24 482 }, 483 "end": { 484 "line": 22, 485 "column": 25 486 } 487 } 488 }, 489 "loc": { 490 "start": { 491 "line": 22, 492 "column": 5 493 }, 494 "end": { 495 "line": 22, 496 "column": 25 497 } 498 } 499 }, 500 { 501 "type": "RestElement", 502 "argument": { 503 "type": "Identifier", 504 "name": "d", 505 "decorators": [], 506 "loc": { 507 "start": { 508 "line": 22, 509 "column": 30 510 }, 511 "end": { 512 "line": 22, 513 "column": 31 514 } 515 } 516 }, 517 "loc": { 518 "start": { 519 "line": 22, 520 "column": 27 521 }, 522 "end": { 523 "line": 22, 524 "column": 31 525 } 526 } 527 } 528 ], 529 "loc": { 530 "start": { 531 "line": 22, 532 "column": 1 533 }, 534 "end": { 535 "line": 22, 536 "column": 32 537 } 538 } 539 }, 540 "right": { 541 "type": "ArrayExpression", 542 "elements": [ 543 { 544 "type": "ObjectExpression", 545 "properties": [], 546 "loc": { 547 "start": { 548 "line": 22, 549 "column": 36 550 }, 551 "end": { 552 "line": 22, 553 "column": 38 554 } 555 } 556 }, 557 { 558 "type": "ArrayExpression", 559 "elements": [ 560 { 561 "type": "NumberLiteral", 562 "value": 42, 563 "loc": { 564 "start": { 565 "line": 22, 566 "column": 41 567 }, 568 "end": { 569 "line": 22, 570 "column": 43 571 } 572 } 573 }, 574 { 575 "type": "OmittedExpression", 576 "loc": { 577 "start": { 578 "line": 22, 579 "column": 45 580 }, 581 "end": { 582 "line": 22, 583 "column": 46 584 } 585 } 586 }, 587 { 588 "type": "BinaryExpression", 589 "operator": "+", 590 "left": { 591 "type": "StringLiteral", 592 "value": "foo", 593 "loc": { 594 "start": { 595 "line": 22, 596 "column": 47 597 }, 598 "end": { 599 "line": 22, 600 "column": 52 601 } 602 } 603 }, 604 "right": { 605 "type": "NumberLiteral", 606 "value": 2, 607 "loc": { 608 "start": { 609 "line": 22, 610 "column": 55 611 }, 612 "end": { 613 "line": 22, 614 "column": 56 615 } 616 } 617 }, 618 "loc": { 619 "start": { 620 "line": 22, 621 "column": 47 622 }, 623 "end": { 624 "line": 22, 625 "column": 56 626 } 627 } 628 } 629 ], 630 "loc": { 631 "start": { 632 "line": 22, 633 "column": 40 634 }, 635 "end": { 636 "line": 22, 637 "column": 57 638 } 639 } 640 } 641 ], 642 "loc": { 643 "start": { 644 "line": 22, 645 "column": 35 646 }, 647 "end": { 648 "line": 22, 649 "column": 58 650 } 651 } 652 }, 653 "loc": { 654 "start": { 655 "line": 22, 656 "column": 1 657 }, 658 "end": { 659 "line": 22, 660 "column": 58 661 } 662 } 663 }, 664 "loc": { 665 "start": { 666 "line": 22, 667 "column": 1 668 }, 669 "end": { 670 "line": 22, 671 "column": 59 672 } 673 } 674 } 675 ], 676 "loc": { 677 "start": { 678 "line": 1, 679 "column": 1 680 }, 681 "end": { 682 "line": 22, 683 "column": 59 684 } 685 } 686} 687TypeError: Type 'number | "foo"' is not assignable to type 'number'. [arrayDestructuring36.ts:22:6] 688