{ "type": "Program", "statements": [ { "type": "ClassDeclaration", "definition": { "id": { "type": "Identifier", "name": "Foo", "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 10 } } }, "superClass": null, "implements": [], "constructor": { "type": "MethodDefinition", "key": { "type": "Identifier", "name": "constructor", "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 1 } } }, "kind": "constructor", "static": false, "optional": false, "computed": false, "value": { "type": "FunctionExpression", "function": { "type": "ScriptFunction", "id": null, "generator": false, "async": false, "expression": false, "params": [], "body": { "type": "BlockStatement", "statements": [], "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 1 } } }, "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 1 } } }, "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 1 } } }, "overloads": [], "decorators": [], "loc": { "start": { "line": 4, "column": 1 }, "end": { "line": 10, "column": 2 } } }, "body": [ { "type": "ClassProperty", "key": { "type": "Identifier", "name": "str", "loc": { "start": { "line": 5, "column": 3 }, "end": { "line": 5, "column": 6 } } }, "value": { "type": "StringLiteral", "value": "hello", "loc": { "start": { "line": 5, "column": 17 }, "end": { "line": 5, "column": 24 } } }, "static": false, "readonly": false, "declare": false, "optional": false, "computed": false, "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 14 } } }, "decorators": [], "loc": { "start": { "line": 5, "column": 3 }, "end": { "line": 5, "column": 24 } } }, { "type": "ClassProperty", "key": { "type": "Identifier", "name": "num", "loc": { "start": { "line": 6, "column": 3 }, "end": { "line": 6, "column": 6 } } }, "value": { "type": "NumberLiteral", "value": 123, "loc": { "start": { "line": 6, "column": 17 }, "end": { "line": 6, "column": 20 } } }, "static": false, "readonly": false, "declare": false, "optional": false, "computed": false, "typeAnnotation": { "type": "TSNumberKeyword", "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 14 } } }, "decorators": [], "loc": { "start": { "line": 6, "column": 3 }, "end": { "line": 6, "column": 20 } } } ], "indexSignatures": [ { "type": "TSIndexSignature", "parameters": { "type": "Identifier", "name": "propName", "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 20 } } }, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 12 } } }, "typeAnnotation": { "type": "TSUnionType", "types": [ { "type": "TSStringKeyword", "loc": { "start": { "line": 7, "column": 23 }, "end": { "line": 7, "column": 29 } } }, { "type": "TSNumberKeyword", "loc": { "start": { "line": 7, "column": 32 }, "end": { "line": 7, "column": 38 } } } ], "loc": { "start": { "line": 7, "column": 23 }, "end": { "line": 7, "column": 38 } } }, "readonly": false, "loc": { "start": { "line": 7, "column": 3 }, "end": { "line": 7, "column": 38 } } }, { "type": "TSIndexSignature", "parameters": { "type": "Identifier", "name": "propName", "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 27 } } }, "loc": { "start": { "line": 8, "column": 11 }, "end": { "line": 8, "column": 19 } } }, "typeAnnotation": { "type": "TSUnionType", "types": [ { "type": "TSStringKeyword", "loc": { "start": { "line": 8, "column": 30 }, "end": { "line": 8, "column": 36 } } }, { "type": "TSNumberKeyword", "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 45 } } } ], "loc": { "start": { "line": 8, "column": 30 }, "end": { "line": 8, "column": 45 } } }, "readonly": false, "loc": { "start": { "line": 8, "column": 3 }, "end": { "line": 8, "column": 45 } } } ], "loc": { "start": { "line": 4, "column": 11 }, "end": { "line": 10, "column": 2 } } }, "decorators": [], "loc": { "start": { "line": 4, "column": 1 }, "end": { "line": 10, "column": 2 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "object": { "type": "Identifier", "name": "Foo", "loc": { "start": { "line": 12, "column": 1 }, "end": { "line": 12, "column": 4 } } }, "property": { "type": "StringLiteral", "value": "whatever", "loc": { "start": { "line": 12, "column": 5 }, "end": { "line": 12, "column": 15 } } }, "computed": true, "optional": false, "loc": { "start": { "line": 12, "column": 1 }, "end": { "line": 12, "column": 16 } } }, "right": { "type": "NumberLiteral", "value": 42, "loc": { "start": { "line": 12, "column": 19 }, "end": { "line": 12, "column": 21 } } }, "loc": { "start": { "line": 12, "column": 1 }, "end": { "line": 12, "column": 21 } } }, "loc": { "start": { "line": 12, "column": 1 }, "end": { "line": 12, "column": 22 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "x", "loc": { "start": { "line": 14, "column": 5 }, "end": { "line": 14, "column": 6 } } }, "init": { "type": "MemberExpression", "object": { "type": "Identifier", "name": "Foo", "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 12 } } }, "property": { "type": "StringLiteral", "value": "whatever", "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 23 } } }, "computed": true, "optional": false, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 24 } } }, "loc": { "start": { "line": 14, "column": 5 }, "end": { "line": 14, "column": 24 } } } ], "kind": "let", "loc": { "start": { "line": 14, "column": 1 }, "end": { "line": 14, "column": 25 } } }, { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "print", "loc": { "start": { "line": 15, "column": 1 }, "end": { "line": 15, "column": 6 } } }, "arguments": [ { "type": "Identifier", "name": "x", "loc": { "start": { "line": 15, "column": 7 }, "end": { "line": 15, "column": 8 } } } ], "optional": false, "loc": { "start": { "line": 15, "column": 1 }, "end": { "line": 15, "column": 9 } } }, "loc": { "start": { "line": 15, "column": 1 }, "end": { "line": 15, "column": 10 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "foo", "typeAnnotation": { "type": "TSTypeReference", "typeName": { "type": "Identifier", "name": "Foo", "loc": { "start": { "line": 17, "column": 10 }, "end": { "line": 17, "column": 13 } } }, "loc": { "start": { "line": 17, "column": 10 }, "end": { "line": 17, "column": 13 } } }, "loc": { "start": { "line": 17, "column": 5 }, "end": { "line": 17, "column": 8 } } }, "init": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "Foo", "loc": { "start": { "line": 17, "column": 20 }, "end": { "line": 17, "column": 23 } } }, "arguments": [], "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 25 } } }, "loc": { "start": { "line": 17, "column": 5 }, "end": { "line": 17, "column": 25 } } } ], "kind": "let", "loc": { "start": { "line": 17, "column": 1 }, "end": { "line": 17, "column": 26 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "object": { "type": "Identifier", "name": "foo", "loc": { "start": { "line": 18, "column": 1 }, "end": { "line": 18, "column": 4 } } }, "property": { "type": "StringLiteral", "value": "word", "loc": { "start": { "line": 18, "column": 5 }, "end": { "line": 18, "column": 11 } } }, "computed": true, "optional": false, "loc": { "start": { "line": 18, "column": 1 }, "end": { "line": 18, "column": 12 } } }, "right": { "type": "StringLiteral", "value": "hi", "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 19 } } }, "loc": { "start": { "line": 18, "column": 1 }, "end": { "line": 18, "column": 19 } } }, "loc": { "start": { "line": 18, "column": 1 }, "end": { "line": 18, "column": 20 } } }, { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "print", "loc": { "start": { "line": 19, "column": 1 }, "end": { "line": 19, "column": 6 } } }, "arguments": [ { "type": "MemberExpression", "object": { "type": "Identifier", "name": "foo", "loc": { "start": { "line": 19, "column": 7 }, "end": { "line": 19, "column": 10 } } }, "property": { "type": "Identifier", "name": "word", "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 15 } } }, "computed": false, "optional": false, "loc": { "start": { "line": 19, "column": 7 }, "end": { "line": 19, "column": 15 } } } ], "optional": false, "loc": { "start": { "line": 19, "column": 1 }, "end": { "line": 19, "column": 16 } } }, "loc": { "start": { "line": 19, "column": 1 }, "end": { "line": 19, "column": 16 } } } ], "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 19, "column": 16 } } }