{ "type": "Script", "span": { "start": 1, "end": 215, "ctxt": 0 }, "body": [ { "type": "TsTypeAliasDeclaration", "span": { "start": 1, "end": 20, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { "start": 6, "end": 7, "ctxt": 0 }, "value": "S", "optional": false }, "typeParams": null, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 10, "end": 19, "ctxt": 0 }, "types": [ { "type": "TsLiteralType", "span": { "start": 10, "end": 13, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { "start": 10, "end": 13, "ctxt": 0 }, "value": "a", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } }, { "type": "TsLiteralType", "span": { "start": 16, "end": 19, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { "start": 16, "end": 19, "ctxt": 0 }, "value": "b", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } } ] } }, { "type": "TsTypeAliasDeclaration", "span": { "start": 21, "end": 38, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { "start": 26, "end": 27, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 30, "end": 37, "ctxt": 0 }, "types": [ { "type": "TsArrayType", "span": { "start": 30, "end": 33, "ctxt": 0 }, "elemType": { "type": "TsTypeReference", "span": { "start": 30, "end": 31, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 30, "end": 31, "ctxt": 0 }, "value": "S", "optional": false }, "typeParams": null } }, { "type": "TsTypeReference", "span": { "start": 36, "end": 37, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 36, "end": 37, "ctxt": 0 }, "value": "S", "optional": false }, "typeParams": null } ] } }, { "type": "FunctionDeclaration", "identifier": { "type": "Identifier", "span": { "start": 49, "end": 50, "ctxt": 0 }, "value": "f", "optional": false }, "declare": false, "params": [ { "type": "Parameter", "span": { "start": 51, "end": 57, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { "start": 51, "end": 57, "ctxt": 0 }, "value": "foo", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 54, "end": 57, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { "start": 56, "end": 57, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 56, "end": 57, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null } } } } ], "decorators": [], "span": { "start": 40, "end": 215, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { "start": 59, "end": 215, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { "start": 65, "end": 213, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { "start": 69, "end": 80, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { "start": 69, "end": 72, "ctxt": 0 }, "value": "foo", "optional": false }, "right": { "type": "StringLiteral", "span": { "start": 77, "end": 80, "ctxt": 0 }, "value": "a", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } }, "consequent": { "type": "BlockStatement", "span": { "start": 82, "end": 109, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { "start": 92, "end": 103, "ctxt": 0 }, "argument": { "type": "Identifier", "span": { "start": 99, "end": 102, "ctxt": 0 }, "value": "foo", "optional": false } } ] }, "alternate": { "type": "IfStatement", "span": { "start": 119, "end": 213, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { "start": 123, "end": 134, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { "start": 123, "end": 126, "ctxt": 0 }, "value": "foo", "optional": false }, "right": { "type": "StringLiteral", "span": { "start": 131, "end": 134, "ctxt": 0 }, "value": "b", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } }, "consequent": { "type": "BlockStatement", "span": { "start": 136, "end": 163, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { "start": 146, "end": 157, "ctxt": 0 }, "argument": { "type": "Identifier", "span": { "start": 153, "end": 156, "ctxt": 0 }, "value": "foo", "optional": false } } ] }, "alternate": { "type": "BlockStatement", "span": { "start": 173, "end": 213, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { "start": 184, "end": 207, "ctxt": 0 }, "argument": { "type": "MemberExpression", "span": { "start": 191, "end": 206, "ctxt": 0 }, "object": { "type": "ParenthesisExpression", "span": { "start": 191, "end": 203, "ctxt": 0 }, "expression": { "type": "TsAsExpression", "span": { "start": 192, "end": 202, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { "start": 192, "end": 195, "ctxt": 0 }, "value": "foo", "optional": false }, "typeAnnotation": { "type": "TsArrayType", "span": { "start": 199, "end": 202, "ctxt": 0 }, "elemType": { "type": "TsTypeReference", "span": { "start": 199, "end": 200, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 199, "end": 200, "ctxt": 0 }, "value": "S", "optional": false }, "typeParams": null } } } }, "property": { "type": "Computed", "span": { "start": 203, "end": 206, "ctxt": 0 }, "expression": { "type": "NumericLiteral", "span": { "start": 204, "end": 205, "ctxt": 0 }, "value": 0.0 } } } } ] } } } ] }, "generator": false, "async": false, "typeParameters": null, "returnType": null } ], "interpreter": null }