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