{ "type": "Program", "statements": [ { "type": "TSDeclareFunction", "function": { "type": "ScriptFunction", "id": { "type": "Identifier", "name": "foo", "decorators": [], "loc": { "start": { "line": 17, "column": 10 }, "end": { "line": 17, "column": 13 } } }, "generator": false, "async": false, "expression": false, "params": [ { "type": "Identifier", "name": "a", "typeAnnotation": { "type": "TSNumberKeyword", "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 23 } } }, "decorators": [], "loc": { "start": { "line": 17, "column": 14 }, "end": { "line": 17, "column": 15 } } }, { "type": "Identifier", "name": "b", "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 34 } } }, "decorators": [], "loc": { "start": { "line": 17, "column": 25 }, "end": { "line": 17, "column": 26 } } } ], "returnType": { "type": "TSTupleType", "elementTypes": [ { "type": "TSNumberKeyword", "loc": { "start": { "line": 17, "column": 38 }, "end": { "line": 17, "column": 45 } } }, { "type": "TSStringKeyword", "loc": { "start": { "line": 17, "column": 46 }, "end": { "line": 17, "column": 53 } } } ], "loc": { "start": { "line": 17, "column": 37 }, "end": { "line": 17, "column": 53 } } }, "loc": { "start": { "line": 17, "column": 1 }, "end": { "line": 17, "column": 54 } } }, "loc": { "start": { "line": 17, "column": 1 }, "end": { "line": 17, "column": 54 } } }, { "type": "TSDeclareFunction", "function": { "type": "ScriptFunction", "id": { "type": "Identifier", "name": "foo", "decorators": [], "loc": { "start": { "line": 18, "column": 10 }, "end": { "line": 18, "column": 13 } } }, "generator": false, "async": false, "expression": false, "params": [ { "type": "Identifier", "name": "a", "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 18, "column": 17 }, "end": { "line": 18, "column": 23 } } }, "decorators": [], "loc": { "start": { "line": 18, "column": 14 }, "end": { "line": 18, "column": 15 } } }, { "type": "Identifier", "name": "b", "typeAnnotation": { "type": "TSBooleanKeyword", "loc": { "start": { "line": 18, "column": 28 }, "end": { "line": 18, "column": 35 } } }, "decorators": [], "loc": { "start": { "line": 18, "column": 25 }, "end": { "line": 18, "column": 26 } } } ], "returnType": { "type": "TSTupleType", "elementTypes": [ { "type": "TSNumberKeyword", "loc": { "start": { "line": 18, "column": 39 }, "end": { "line": 18, "column": 46 } } }, { "type": "TSStringKeyword", "loc": { "start": { "line": 18, "column": 47 }, "end": { "line": 18, "column": 54 } } } ], "loc": { "start": { "line": 18, "column": 38 }, "end": { "line": 18, "column": 54 } } }, "loc": { "start": { "line": 18, "column": 1 }, "end": { "line": 18, "column": 55 } } }, "loc": { "start": { "line": 18, "column": 1 }, "end": { "line": 18, "column": 55 } } }, { "type": "TSDeclareFunction", "function": { "type": "ScriptFunction", "id": { "type": "Identifier", "name": "foo", "decorators": [], "loc": { "start": { "line": 19, "column": 10 }, "end": { "line": 19, "column": 13 } } }, "generator": false, "async": false, "expression": false, "params": [ { "type": "Identifier", "name": "a", "typeAnnotation": { "type": "TSBigIntKeyword", "loc": { "start": { "line": 19, "column": 17 }, "end": { "line": 19, "column": 23 } } }, "decorators": [], "loc": { "start": { "line": 19, "column": 14 }, "end": { "line": 19, "column": 15 } } }, { "type": "Identifier", "name": "b", "typeAnnotation": { "type": "TSBooleanKeyword", "loc": { "start": { "line": 19, "column": 28 }, "end": { "line": 19, "column": 35 } } }, "decorators": [], "loc": { "start": { "line": 19, "column": 25 }, "end": { "line": 19, "column": 26 } } } ], "returnType": { "type": "TSTupleType", "elementTypes": [ { "type": "TSNumberKeyword", "loc": { "start": { "line": 19, "column": 39 }, "end": { "line": 19, "column": 46 } } }, { "type": "TSStringKeyword", "loc": { "start": { "line": 19, "column": 47 }, "end": { "line": 19, "column": 54 } } } ], "loc": { "start": { "line": 19, "column": 38 }, "end": { "line": 19, "column": 54 } } }, "loc": { "start": { "line": 19, "column": 1 }, "end": { "line": 19, "column": 55 } } }, "loc": { "start": { "line": 19, "column": 1 }, "end": { "line": 19, "column": 55 } } }, { "type": "FunctionDeclaration", "function": { "type": "ScriptFunction", "id": { "type": "Identifier", "name": "foo", "decorators": [], "loc": { "start": { "line": 20, "column": 10 }, "end": { "line": 20, "column": 13 } } }, "generator": false, "async": false, "expression": false, "params": [ { "type": "Identifier", "name": "a", "typeAnnotation": { "type": "TSUnionType", "types": [ { "type": "TSStringKeyword", "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 20, "column": 23 } } }, { "type": "TSNumberKeyword", "loc": { "start": { "line": 20, "column": 26 }, "end": { "line": 20, "column": 32 } } }, { "type": "TSBigIntKeyword", "loc": { "start": { "line": 20, "column": 35 }, "end": { "line": 20, "column": 41 } } } ], "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 20, "column": 41 } } }, "decorators": [], "loc": { "start": { "line": 20, "column": 14 }, "end": { "line": 20, "column": 15 } } }, { "type": "Identifier", "name": "b", "typeAnnotation": { "type": "TSUnionType", "types": [ { "type": "TSBooleanKeyword", "loc": { "start": { "line": 20, "column": 46 }, "end": { "line": 20, "column": 53 } } }, { "type": "TSStringKeyword", "loc": { "start": { "line": 20, "column": 56 }, "end": { "line": 20, "column": 62 } } } ], "loc": { "start": { "line": 20, "column": 46 }, "end": { "line": 20, "column": 62 } } }, "decorators": [], "loc": { "start": { "line": 20, "column": 43 }, "end": { "line": 20, "column": 44 } } } ], "returnType": { "type": "TSTupleType", "elementTypes": [ { "type": "TSNumberKeyword", "loc": { "start": { "line": 20, "column": 66 }, "end": { "line": 20, "column": 73 } } }, { "type": "TSStringKeyword", "loc": { "start": { "line": 20, "column": 74 }, "end": { "line": 20, "column": 81 } } } ], "loc": { "start": { "line": 20, "column": 65 }, "end": { "line": 20, "column": 81 } } }, "body": { "type": "BlockStatement", "statements": [ { "type": "ReturnStatement", "argument": { "type": "ArrayExpression", "elements": [ { "type": "NumberLiteral", "value": 1, "loc": { "start": { "line": 21, "column": 13 }, "end": { "line": 21, "column": 14 } } }, { "type": "StringLiteral", "value": "foo", "loc": { "start": { "line": 21, "column": 16 }, "end": { "line": 21, "column": 21 } } } ], "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 22 } } }, "loc": { "start": { "line": 21, "column": 5 }, "end": { "line": 21, "column": 23 } } } ], "loc": { "start": { "line": 20, "column": 82 }, "end": { "line": 22, "column": 2 } } }, "loc": { "start": { "line": 20, "column": 1 }, "end": { "line": 22, "column": 2 } } }, "loc": { "start": { "line": 20, "column": 1 }, "end": { "line": 22, "column": 2 } } }, { "type": "ExpressionStatement", "expression": { "type": "BinaryExpression", "operator": "+", "left": { "type": "Identifier", "name": "foo", "decorators": [], "loc": { "start": { "line": 24, "column": 1 }, "end": { "line": 24, "column": 4 } } }, "right": { "type": "NumberLiteral", "value": 5, "loc": { "start": { "line": 24, "column": 7 }, "end": { "line": 24, "column": 8 } } }, "loc": { "start": { "line": 24, "column": 1 }, "end": { "line": 24, "column": 8 } } }, "loc": { "start": { "line": 24, "column": 1 }, "end": { "line": 24, "column": 9 } } } ], "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 24, "column": 9 } } } TypeError: 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]