{ "type": "Script", "span": { "start": 41, "end": 824, "ctxt": 0 }, "body": [ { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 50, "end": 52, "ctxt": 0 }, "value": "f1", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 56, "end": 85, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 56, "end": 85, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 57, "end": 85, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 59, "end": 85, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 59, "end": 69, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 59, "end": 60, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 59, "end": 60, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 63, "end": 69, "ctxt": 0 }, "kind": "string" } ] }, { "type": "TsIntersectionType", "span": { "start": 72, "end": 85, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 72, "end": 73, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 72, "end": 73, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 76, "end": 85, "ctxt": 0 }, "kind": "undefined" } ] } ] } } } } ], "decorators": [], "span": { "start": 41, "end": 152, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 87, "end": 152, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { "start": 93, "end": 150, "ctxt": 0 }, "test": { "type": "Identifier", "span": { "start": 97, "end": 98, "ctxt": 0 }, "value": "x", "optional": false }, "consequent": { "type": "BlockStatement", "span": { "start": 100, "end": 150, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 110, "end": 112, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 110, "end": 111, "ctxt": 0 }, "value": "x", "optional": false } } ] }, "alternate": null } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 52, "end": 55, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 53, "end": 54, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 53, "end": 54, "ctxt": 0 }, "value": "T", "optional": false }, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 163, "end": 165, "ctxt": 0 }, "value": "f2", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 169, "end": 198, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 169, "end": 198, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 170, "end": 198, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 172, "end": 198, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 172, "end": 182, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 172, "end": 173, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 172, "end": 173, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 176, "end": 182, "ctxt": 0 }, "kind": "string" } ] }, { "type": "TsIntersectionType", "span": { "start": 185, "end": 198, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 185, "end": 186, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 185, "end": 186, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 189, "end": 198, "ctxt": 0 }, "kind": "undefined" } ] } ] } } } } ], "decorators": [], "span": { "start": 154, "end": 342, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 200, "end": 342, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { "start": 206, "end": 340, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { "start": 210, "end": 225, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { "start": 210, "end": 211, "ctxt": 0 }, "value": "x", "optional": false }, "right": { "type": "Identifier", "span": { "start": 216, "end": 225, "ctxt": 0 }, "value": "undefined", "optional": false } }, "consequent": { "type": "BlockStatement", "span": { "start": 227, "end": 277, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 237, "end": 239, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 237, "end": 238, "ctxt": 0 }, "value": "x", "optional": false } } ] }, "alternate": { "type": "BlockStatement", "span": { "start": 287, "end": 340, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 297, "end": 299, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 297, "end": 298, "ctxt": 0 }, "value": "x", "optional": false } } ] } } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 165, "end": 168, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 166, "end": 167, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 166, "end": 167, "ctxt": 0 }, "value": "T", "optional": false }, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 353, "end": 355, "ctxt": 0 }, "value": "f3", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 359, "end": 385, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 359, "end": 385, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 360, "end": 385, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 362, "end": 385, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 362, "end": 372, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 362, "end": 363, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 362, "end": 363, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 366, "end": 372, "ctxt": 0 }, "kind": "string" } ] }, { "type": "TsIntersectionType", "span": { "start": 375, "end": 385, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 375, "end": 376, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 375, "end": 376, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 379, "end": 385, "ctxt": 0 }, "kind": "number" } ] } ] } } } } ], "decorators": [], "span": { "start": 344, "end": 532, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 387, "end": 532, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { "start": 393, "end": 530, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { "start": 397, "end": 418, "ctxt": 0 }, "operator": "===", "left": { "type": "UnaryExpression", "span": { "start": 397, "end": 405, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { "start": 404, "end": 405, "ctxt": 0 }, "value": "x", "optional": false } }, "right": { "type": "StringLiteral", "span": { "start": 410, "end": 418, "ctxt": 0 }, "value": "string", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } }, "consequent": { "type": "BlockStatement", "span": { "start": 420, "end": 470, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 430, "end": 432, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 430, "end": 431, "ctxt": 0 }, "value": "x", "optional": false } } ] }, "alternate": { "type": "BlockStatement", "span": { "start": 480, "end": 530, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 490, "end": 492, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 490, "end": 491, "ctxt": 0 }, "value": "x", "optional": false } } ] } } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 355, "end": 358, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 356, "end": 357, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 356, "end": 357, "ctxt": 0 }, "value": "T", "optional": false }, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 543, "end": 545, "ctxt": 0 }, "value": "f4", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 549, "end": 565, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 549, "end": 565, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 550, "end": 565, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 552, "end": 565, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 552, "end": 557, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 552, "end": 553, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 552, "end": 553, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsLiteralType", "span": { "start": 556, "end": 557, "ctxt": 0 }, "literal": { "type": "NumericLiteral", "span": { "start": 556, "end": 557, "ctxt": 0 }, "value": 1.0 } } ] }, { "type": "TsIntersectionType", "span": { "start": 560, "end": 565, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 560, "end": 561, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 560, "end": 561, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsLiteralType", "span": { "start": 564, "end": 565, "ctxt": 0 }, "literal": { "type": "NumericLiteral", "span": { "start": 564, "end": 565, "ctxt": 0 }, "value": 2.0 } } ] } ] } } } } ], "decorators": [], "span": { "start": 534, "end": 712, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 567, "end": 712, "ctxt": 0 }, "stmts": [ { "type": "SwitchStatement", "span": { "start": 573, "end": 710, "ctxt": 0 }, "discriminant": { "type": "Identifier", "span": { "start": 581, "end": 582, "ctxt": 0 }, "value": "x", "optional": false }, "cases": [ { "type": "SwitchCase", "span": { "start": 594, "end": 611, "ctxt": 0 }, "test": { "type": "NumericLiteral", "span": { "start": 599, "end": 600, "ctxt": 0 }, "value": 1.0 }, "consequent": [ { "type": "ExpressionStatement", "span": { "start": 602, "end": 604, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 602, "end": 603, "ctxt": 0 }, "value": "x", "optional": false } }, { "type": "BreakStatement", "span": { "start": 605, "end": 611, "ctxt": 0 }, "label": null } ] }, { "type": "SwitchCase", "span": { "start": 630, "end": 647, "ctxt": 0 }, "test": { "type": "NumericLiteral", "span": { "start": 635, "end": 636, "ctxt": 0 }, "value": 2.0 }, "consequent": [ { "type": "ExpressionStatement", "span": { "start": 638, "end": 640, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 638, "end": 639, "ctxt": 0 }, "value": "x", "optional": false } }, { "type": "BreakStatement", "span": { "start": 641, "end": 647, "ctxt": 0 }, "label": null } ] }, { "type": "SwitchCase", "span": { "start": 666, "end": 677, "ctxt": 0 }, "test": null, "consequent": [ { "type": "ExpressionStatement", "span": { "start": 675, "end": 677, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 675, "end": 676, "ctxt": 0 }, "value": "x", "optional": false } } ] } ] } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 545, "end": 548, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 546, "end": 547, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 546, "end": 547, "ctxt": 0 }, "value": "T", "optional": false }, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 723, "end": 725, "ctxt": 0 }, "value": "f5", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 753, "end": 766, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 753, "end": 766, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 754, "end": 766, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { "start": 756, "end": 766, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 756, "end": 757, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 756, "end": 757, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 760, "end": 766, "ctxt": 0 }, "kind": "number" } ] } } } } ], "decorators": [], "span": { "start": 714, "end": 824, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 768, "end": 824, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { "start": 774, "end": 799, "ctxt": 0 }, "kind": "const", "declare": false, "declarations": [ { "type": "VariableDeclarator", "span": { "start": 780, "end": 798, "ctxt": 0 }, "id": { "type": "Identifier", "span": { "start": 780, "end": 782, "ctxt": 0 }, "value": "t1", "optional": false, "typeAnnotation": null }, "init": { "type": "BinaryExpression", "span": { "start": 785, "end": 798, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { "start": 785, "end": 786, "ctxt": 0 }, "value": "x", "optional": false }, "right": { "type": "StringLiteral", "span": { "start": 791, "end": 798, "ctxt": 0 }, "value": "hello", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } }, "definite": false } ] } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 725, "end": 752, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 726, "end": 751, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 726, "end": 727, "ctxt": 0 }, "value": "T", "optional": false }, "constraint": { "type": "TsUnionType", "span": { "start": 736, "end": 751, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { "start": 736, "end": 742, "ctxt": 0 }, "kind": "string" }, { "type": "TsKeywordType", "span": { "start": 745, "end": 751, "ctxt": 0 }, "kind": "number" } ] }, "default": null } ] }, "returnType": null } ], "interpreter": null }