swc/crates/swc_ecma_parser/tests/tsc/controlFlowIfStatement.json

1972 lines
53 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 32,
"end": 1010,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 32,
"end": 74,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 36,
"end": 73,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 73,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 39,
"end": 73,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 54,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 57,
"end": 64,
"ctxt": 0
},
"kind": "boolean"
},
{
"type": "TsTypeReference",
"span": {
"start": 67,
"end": 73,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 67,
"end": 73,
"ctxt": 0
},
"value": "RegExp",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 75,
"end": 93,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 79,
"end": 92,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 79,
"end": 83,
"ctxt": 0
},
"value": "cond",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 85,
"end": 92,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 95,
"end": 103,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 95,
"end": 102,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 95,
"end": 96,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "RegExpLiteral",
"span": {
"start": 99,
"end": 102,
"ctxt": 0
},
"pattern": "a",
"flags": ""
}
}
},
{
"type": "IfStatement",
"span": {
"start": 104,
"end": 208,
"ctxt": 0
},
"test": {
"type": "SequenceExpression",
"span": {
"start": 108,
"end": 134,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "x",
"optional": false
},
{
"type": "ParenthesisExpression",
"span": {
"start": 124,
"end": 134,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 129,
"end": 133,
"ctxt": 0
},
"value": true
}
}
}
]
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 136,
"end": 169,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 142,
"end": 144,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 160,
"end": 167,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 160,
"end": 166,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 164,
"end": 166,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 175,
"end": 208,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 181,
"end": 183,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 199,
"end": 206,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 199,
"end": 205,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 203,
"end": 205,
"ctxt": 0
},
"value": 42.0
}
}
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 209,
"end": 211,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "a",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 232,
"end": 380,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 245,
"end": 380,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 251,
"end": 274,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 255,
"end": 273,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 256,
"end": 273,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 258,
"end": 273,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 258,
"end": 264,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 267,
"end": 273,
"ctxt": 0
},
"kind": "number"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 279,
"end": 361,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 283,
"end": 287,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 289,
"end": 312,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 299,
"end": 306,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 299,
"end": 305,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 303,
"end": 305,
"ctxt": 0
},
"value": 42.0
}
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 322,
"end": 361,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 332,
"end": 339,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 332,
"end": 338,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 332,
"end": 333,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 336,
"end": 338,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ReturnStatement",
"span": {
"start": 348,
"end": 355,
"ctxt": 0
},
"argument": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 366,
"end": 368,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"value": "b",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 381,
"end": 531,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 394,
"end": 531,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 400,
"end": 423,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 404,
"end": 422,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 405,
"end": 422,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 407,
"end": 422,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 407,
"end": 413,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 416,
"end": 422,
"ctxt": 0
},
"kind": "number"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 428,
"end": 512,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 432,
"end": 436,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 438,
"end": 479,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 448,
"end": 455,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 448,
"end": 454,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 448,
"end": 449,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 452,
"end": 454,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "ThrowStatement",
"span": {
"start": 464,
"end": 473,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 470,
"end": 472,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 489,
"end": 512,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 499,
"end": 506,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 499,
"end": 505,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 499,
"end": 500,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 503,
"end": 505,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 517,
"end": 519,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 517,
"end": 518,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 541,
"end": 542,
"ctxt": 0
},
"value": "c",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 546,
"end": 562,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 546,
"end": 562,
"ctxt": 0
},
"value": "data",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 550,
"end": 562,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 552,
"end": 562,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 552,
"end": 558,
"ctxt": 0
},
"kind": "string"
},
{
"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
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 532,
"end": 683,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 567,
"end": 683,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 573,
"end": 681,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 577,
"end": 601,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 577,
"end": 588,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 584,
"end": 588,
"ctxt": 0
},
"value": "data",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 593,
"end": 601,
"ctxt": 0
},
"value": "string",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 603,
"end": 643,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 613,
"end": 637,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 620,
"end": 636,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 620,
"end": 630,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 620,
"end": 624,
"ctxt": 0
},
"value": "JSON",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 625,
"end": 630,
"ctxt": 0
},
"value": "parse",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 631,
"end": 635,
"ctxt": 0
},
"value": "data",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 653,
"end": 681,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 663,
"end": 675,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 670,
"end": 674,
"ctxt": 0
},
"value": "data",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 542,
"end": 545,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 543,
"end": 544,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 543,
"end": 544,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 563,
"end": 566,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 565,
"end": 566,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 565,
"end": 566,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 693,
"end": 694,
"ctxt": 0
},
"value": "d",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 713,
"end": 729,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 713,
"end": 729,
"ctxt": 0
},
"value": "data",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 717,
"end": 729,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 719,
"end": 729,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 719,
"end": 725,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsTypeReference",
"span": {
"start": 728,
"end": 729,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 728,
"end": 729,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 684,
"end": 868,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 738,
"end": 868,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 744,
"end": 866,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 748,
"end": 772,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 748,
"end": 759,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 755,
"end": 759,
"ctxt": 0
},
"value": "data",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 764,
"end": 772,
"ctxt": 0
},
"value": "string",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 774,
"end": 828,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 784,
"end": 822,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 790,
"end": 821,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 794,
"end": 799,
"ctxt": 0
},
"value": "Error",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 800,
"end": 820,
"ctxt": 0
},
"value": "will always happen",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 838,
"end": 866,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 848,
"end": 860,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 855,
"end": 859,
"ctxt": 0
},
"value": "data",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 694,
"end": 712,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 695,
"end": 711,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 695,
"end": 696,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsKeywordType",
"span": {
"start": 705,
"end": 711,
"ctxt": 0
},
"kind": "string"
},
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 730,
"end": 737,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 732,
"end": 737,
"ctxt": 0
},
"kind": "never"
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 870,
"end": 896,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 880,
"end": 881,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 881,
"end": 884,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 882,
"end": 883,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 882,
"end": 883,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 885,
"end": 896,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 889,
"end": 894,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 889,
"end": 890,
"ctxt": 0
},
"value": "p",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 890,
"end": 893,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 892,
"end": 893,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 892,
"end": 893,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 906,
"end": 907,
"ctxt": 0
},
"value": "e",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 908,
"end": 923,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 908,
"end": 923,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 909,
"end": 923,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 911,
"end": 923,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 911,
"end": 912,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 912,
"end": 923,
"ctxt": 0
},
"params": [
{
"type": "TsUnionType",
"span": {
"start": 913,
"end": 922,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 913,
"end": 916,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 913,
"end": 916,
"ctxt": 0
},
"value": "A",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "TsLiteralType",
"span": {
"start": 919,
"end": 922,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 919,
"end": 922,
"ctxt": 0
},
"value": "B",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 897,
"end": 1010,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 925,
"end": 1010,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 931,
"end": 1008,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 935,
"end": 946,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 935,
"end": 938,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 935,
"end": 936,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 937,
"end": 938,
"ctxt": 0
},
"value": "p",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 943,
"end": 946,
"ctxt": 0
},
"value": "A",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 948,
"end": 1008,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 958,
"end": 1002,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 962,
"end": 1002,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 962,
"end": 963,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 963,
"end": 968,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 965,
"end": 968,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 965,
"end": 968,
"ctxt": 0
},
"value": "A",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"init": {
"type": "ParenthesisExpression",
"span": {
"start": 971,
"end": 1002,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 972,
"end": 1001,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 972,
"end": 987,
"ctxt": 0
},
"expression": {
"type": "NullLiteral",
"span": {
"start": 972,
"end": 976,
"ctxt": 0
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 980,
"end": 987,
"ctxt": 0
},
"kind": "unknown"
}
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 991,
"end": 1001,
"ctxt": 0
},
"exprName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 998,
"end": 999,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 1000,
"end": 1001,
"ctxt": 0
},
"value": "p",
"optional": false
}
},
"typeArguments": null
}
}
},
"definite": false
}
]
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}