{ "type": "Script", "span": { "start": 42, "end": 825, "ctxt": 0 }, "body": [ { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 51, "end": 53, "ctxt": 0 }, "value": "f1", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 57, "end": 86, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 57, "end": 86, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 58, "end": 86, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 60, "end": 86, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 60, "end": 70, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 60, "end": 61, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 60, "end": 61, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 64, "end": 70, "ctxt": 0 }, "kind": "string" } ] }, { "type": "TsIntersectionType", "span": { "start": 73, "end": 86, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 73, "end": 74, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 73, "end": 74, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 77, "end": 86, "ctxt": 0 }, "kind": "undefined" } ] } ] } } } } ], "decorators": [], "span": { "start": 42, "end": 153, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 88, "end": 153, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { "start": 94, "end": 151, "ctxt": 0 }, "test": { "type": "Identifier", "span": { "start": 98, "end": 99, "ctxt": 0 }, "value": "x", "optional": false }, "consequent": { "type": "BlockStatement", "span": { "start": 101, "end": 151, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 111, "end": 113, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 111, "end": 112, "ctxt": 0 }, "value": "x", "optional": false } } ] }, "alternate": null } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 53, "end": 56, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 54, "end": 55, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 54, "end": 55, "ctxt": 0 }, "value": "T", "optional": false }, "in": false, "out": false, "const": false, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 164, "end": 166, "ctxt": 0 }, "value": "f2", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 170, "end": 199, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 170, "end": 199, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 171, "end": 199, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 173, "end": 199, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 173, "end": 183, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 173, "end": 174, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 173, "end": 174, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 177, "end": 183, "ctxt": 0 }, "kind": "string" } ] }, { "type": "TsIntersectionType", "span": { "start": 186, "end": 199, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 186, "end": 187, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 186, "end": 187, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 190, "end": 199, "ctxt": 0 }, "kind": "undefined" } ] } ] } } } } ], "decorators": [], "span": { "start": 155, "end": 343, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 201, "end": 343, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { "start": 207, "end": 341, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { "start": 211, "end": 226, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { "start": 211, "end": 212, "ctxt": 0 }, "value": "x", "optional": false }, "right": { "type": "Identifier", "span": { "start": 217, "end": 226, "ctxt": 0 }, "value": "undefined", "optional": false } }, "consequent": { "type": "BlockStatement", "span": { "start": 228, "end": 278, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 238, "end": 240, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 238, "end": 239, "ctxt": 0 }, "value": "x", "optional": false } } ] }, "alternate": { "type": "BlockStatement", "span": { "start": 288, "end": 341, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 298, "end": 300, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 298, "end": 299, "ctxt": 0 }, "value": "x", "optional": false } } ] } } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 166, "end": 169, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 167, "end": 168, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 167, "end": 168, "ctxt": 0 }, "value": "T", "optional": false }, "in": false, "out": false, "const": false, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 354, "end": 356, "ctxt": 0 }, "value": "f3", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 360, "end": 386, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 360, "end": 386, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 361, "end": 386, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 363, "end": 386, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 363, "end": 373, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 363, "end": 364, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 363, "end": 364, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 367, "end": 373, "ctxt": 0 }, "kind": "string" } ] }, { "type": "TsIntersectionType", "span": { "start": 376, "end": 386, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 376, "end": 377, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 376, "end": 377, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 380, "end": 386, "ctxt": 0 }, "kind": "number" } ] } ] } } } } ], "decorators": [], "span": { "start": 345, "end": 533, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 388, "end": 533, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { "start": 394, "end": 531, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { "start": 398, "end": 419, "ctxt": 0 }, "operator": "===", "left": { "type": "UnaryExpression", "span": { "start": 398, "end": 406, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { "start": 405, "end": 406, "ctxt": 0 }, "value": "x", "optional": false } }, "right": { "type": "StringLiteral", "span": { "start": 411, "end": 419, "ctxt": 0 }, "value": "string", "raw": "\"string\"" } }, "consequent": { "type": "BlockStatement", "span": { "start": 421, "end": 471, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 431, "end": 433, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 431, "end": 432, "ctxt": 0 }, "value": "x", "optional": false } } ] }, "alternate": { "type": "BlockStatement", "span": { "start": 481, "end": 531, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 491, "end": 493, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 491, "end": 492, "ctxt": 0 }, "value": "x", "optional": false } } ] } } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 356, "end": 359, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 357, "end": 358, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 357, "end": 358, "ctxt": 0 }, "value": "T", "optional": false }, "in": false, "out": false, "const": false, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 544, "end": 546, "ctxt": 0 }, "value": "f4", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 550, "end": 566, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 550, "end": 566, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 551, "end": 566, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 553, "end": 566, "ctxt": 0 }, "types": [ { "type": "TsIntersectionType", "span": { "start": 553, "end": 558, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 553, "end": 554, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 553, "end": 554, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsLiteralType", "span": { "start": 557, "end": 558, "ctxt": 0 }, "literal": { "type": "NumericLiteral", "span": { "start": 557, "end": 558, "ctxt": 0 }, "value": 1.0, "raw": "1" } } ] }, { "type": "TsIntersectionType", "span": { "start": 561, "end": 566, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 561, "end": 562, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 561, "end": 562, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsLiteralType", "span": { "start": 565, "end": 566, "ctxt": 0 }, "literal": { "type": "NumericLiteral", "span": { "start": 565, "end": 566, "ctxt": 0 }, "value": 2.0, "raw": "2" } } ] } ] } } } } ], "decorators": [], "span": { "start": 535, "end": 713, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 568, "end": 713, "ctxt": 0 }, "stmts": [ { "type": "SwitchStatement", "span": { "start": 574, "end": 711, "ctxt": 0 }, "discriminant": { "type": "Identifier", "span": { "start": 582, "end": 583, "ctxt": 0 }, "value": "x", "optional": false }, "cases": [ { "type": "SwitchCase", "span": { "start": 595, "end": 612, "ctxt": 0 }, "test": { "type": "NumericLiteral", "span": { "start": 600, "end": 601, "ctxt": 0 }, "value": 1.0, "raw": "1" }, "consequent": [ { "type": "ExpressionStatement", "span": { "start": 603, "end": 605, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 603, "end": 604, "ctxt": 0 }, "value": "x", "optional": false } }, { "type": "BreakStatement", "span": { "start": 606, "end": 612, "ctxt": 0 }, "label": null } ] }, { "type": "SwitchCase", "span": { "start": 631, "end": 648, "ctxt": 0 }, "test": { "type": "NumericLiteral", "span": { "start": 636, "end": 637, "ctxt": 0 }, "value": 2.0, "raw": "2" }, "consequent": [ { "type": "ExpressionStatement", "span": { "start": 639, "end": 641, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 639, "end": 640, "ctxt": 0 }, "value": "x", "optional": false } }, { "type": "BreakStatement", "span": { "start": 642, "end": 648, "ctxt": 0 }, "label": null } ] }, { "type": "SwitchCase", "span": { "start": 667, "end": 678, "ctxt": 0 }, "test": null, "consequent": [ { "type": "ExpressionStatement", "span": { "start": 676, "end": 678, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 676, "end": 677, "ctxt": 0 }, "value": "x", "optional": false } } ] } ] } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 546, "end": 549, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 547, "end": 548, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 547, "end": 548, "ctxt": 0 }, "value": "T", "optional": false }, "in": false, "out": false, "const": false, "constraint": null, "default": null } ] }, "returnType": null }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 724, "end": 726, "ctxt": 0 }, "value": "f5", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 754, "end": 767, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 754, "end": 767, "ctxt": 0 }, "value": "x", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 755, "end": 767, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { "start": 757, "end": 767, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 757, "end": 758, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 757, "end": 758, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 761, "end": 767, "ctxt": 0 }, "kind": "number" } ] } } } } ], "decorators": [], "span": { "start": 715, "end": 825, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 769, "end": 825, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { "start": 775, "end": 800, "ctxt": 0 }, "kind": "const", "declare": false, "declarations": [ { "type": "VariableDeclarator", "span": { "start": 781, "end": 799, "ctxt": 0 }, "id": { "type": "Identifier", "span": { "start": 781, "end": 783, "ctxt": 0 }, "value": "t1", "optional": false, "typeAnnotation": null }, "init": { "type": "BinaryExpression", "span": { "start": 786, "end": 799, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { "start": 786, "end": 787, "ctxt": 0 }, "value": "x", "optional": false }, "right": { "type": "StringLiteral", "span": { "start": 792, "end": 799, "ctxt": 0 }, "value": "hello", "raw": "\"hello\"" } }, "definite": false } ] } ] }, "generator": false, "async": false, "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { "start": 726, "end": 753, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 727, "end": 752, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 727, "end": 728, "ctxt": 0 }, "value": "T", "optional": false }, "in": false, "out": false, "const": false, "constraint": { "type": "TsUnionType", "span": { "start": 737, "end": 752, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { "start": 737, "end": 743, "ctxt": 0 }, "kind": "string" }, { "type": "TsKeywordType", "span": { "start": 746, "end": 752, "ctxt": 0 }, "kind": "number" } ] }, "default": null } ] }, "returnType": null } ], "interpreter": null }