{ "type": "Script", "span": { "start": 40, "end": 218, "ctxt": 0 }, "body": [ { "type": "TsInterfaceDeclaration", "span": { "start": 40, "end": 126, "ctxt": 0 }, "id": { "type": "Identifier", "span": { "start": 50, "end": 51, "ctxt": 0 }, "value": "Y", "optional": false }, "declare": false, "typeParams": null, "extends": [], "body": { "type": "TsInterfaceBody", "span": { "start": 52, "end": 126, "ctxt": 0 }, "body": [ { "type": "TsMethodSignature", "span": { "start": 58, "end": 94, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { "start": 58, "end": 61, "ctxt": 0 }, "value": "foo", "optional": false }, "computed": false, "optional": false, "params": [ { "type": "Identifier", "span": { "start": 65, "end": 72, "ctxt": 0 }, "value": "this", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 69, "end": 72, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { "start": 71, "end": 72, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 71, "end": 72, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null } } }, { "type": "Identifier", "span": { "start": 74, "end": 86, "ctxt": 0 }, "value": "arg", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 77, "end": 86, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeOperator", "span": { "start": 79, "end": 86, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsTypeReference", "span": { "start": 85, "end": 86, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 85, "end": 86, "ctxt": 0 }, "value": "T", "optional": false }, "typeParams": null } } } } ], "typeAnn": { "type": "TsTypeAnnotation", "span": { "start": 87, "end": 93, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { "start": 89, "end": 93, "ctxt": 0 }, "kind": "void" } }, "typeParams": { "type": "TsTypeParameterDeclaration", "span": { "start": 61, "end": 64, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { "start": 62, "end": 63, "ctxt": 0 }, "name": { "type": "Identifier", "span": { "start": 62, "end": 63, "ctxt": 0 }, "value": "T", "optional": false }, "constraint": null, "default": null } ] } }, { "type": "TsPropertySignature", "span": { "start": 99, "end": 109, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { "start": 99, "end": 100, "ctxt": 0 }, "value": "a", "optional": false }, "computed": false, "optional": false, "init": null, "params": [], "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 100, "end": 108, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { "start": 102, "end": 108, "ctxt": 0 }, "kind": "number" } }, "typeParams": null }, { "type": "TsPropertySignature", "span": { "start": 114, "end": 124, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { "start": 114, "end": 115, "ctxt": 0 }, "value": "b", "optional": false }, "computed": false, "optional": false, "init": null, "params": [], "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 115, "end": 123, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { "start": 117, "end": 123, "ctxt": 0 }, "kind": "string" } }, "typeParams": null } ] } }, { "type": "VariableDeclaration", "span": { "start": 128, "end": 163, "ctxt": 0 }, "kind": "const", "declare": true, "declarations": [ { "type": "VariableDeclarator", "span": { "start": 142, "end": 162, "ctxt": 0 }, "id": { "type": "Identifier", "span": { "start": 142, "end": 147, "ctxt": 0 }, "value": "value", "optional": false, "typeAnnotation": { "type": "TsTypeAnnotation", "span": { "start": 147, "end": 162, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { "start": 149, "end": 162, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { "start": 149, "end": 150, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { "start": 149, "end": 150, "ctxt": 0 }, "value": "Y", "optional": false }, "typeParams": null }, { "type": "TsKeywordType", "span": { "start": 153, "end": 162, "ctxt": 0 }, "kind": "undefined" } ] } } }, "init": null, "definite": false } ] }, { "type": "IfStatement", "span": { "start": 165, "end": 200, "ctxt": 0 }, "test": { "type": "Identifier", "span": { "start": 169, "end": 174, "ctxt": 0 }, "value": "value", "optional": false }, "consequent": { "type": "BlockStatement", "span": { "start": 176, "end": 200, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { "start": 182, "end": 198, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { "start": 182, "end": 197, "ctxt": 0 }, "callee": { "type": "OptionalChainingExpression", "span": { "start": 182, "end": 192, "ctxt": 0 }, "questionDotToken": { "start": 187, "end": 188, "ctxt": 0 }, "expr": { "type": "MemberExpression", "span": { "start": 182, "end": 192, "ctxt": 0 }, "object": { "type": "Identifier", "span": { "start": 182, "end": 187, "ctxt": 0 }, "value": "value", "optional": false }, "property": { "type": "Identifier", "span": { "start": 189, "end": 192, "ctxt": 0 }, "value": "foo", "optional": false } } }, "arguments": [ { "spread": null, "expression": { "type": "StringLiteral", "span": { "start": 193, "end": 196, "ctxt": 0 }, "value": "a", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } } ], "typeArguments": null } } ] }, "alternate": null }, { "type": "ExpressionStatement", "span": { "start": 202, "end": 218, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { "start": 202, "end": 217, "ctxt": 0 }, "callee": { "type": "OptionalChainingExpression", "span": { "start": 202, "end": 212, "ctxt": 0 }, "questionDotToken": { "start": 207, "end": 208, "ctxt": 0 }, "expr": { "type": "MemberExpression", "span": { "start": 202, "end": 212, "ctxt": 0 }, "object": { "type": "Identifier", "span": { "start": 202, "end": 207, "ctxt": 0 }, "value": "value", "optional": false }, "property": { "type": "Identifier", "span": { "start": 209, "end": 212, "ctxt": 0 }, "value": "foo", "optional": false } } }, "arguments": [ { "spread": null, "expression": { "type": "StringLiteral", "span": { "start": 213, "end": 216, "ctxt": 0 }, "value": "a", "hasEscape": false, "kind": { "type": "normal", "containsQuote": true } } } ], "typeArguments": null } } ], "interpreter": null }