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

388 lines
8.8 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 227,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 13,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 12,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 7,
"ctxt": 0
},
"value": "as",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 10,
"end": 12,
"ctxt": 0
},
"value": 43.0,
"raw": "43"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 14,
"end": 42,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 18,
"end": 41,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 18,
"end": 19,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 22,
"end": 41,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 22,
"end": 31,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"kind": "number"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 43,
"end": 75,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 47,
"end": 74,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 47,
"end": 48,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 51,
"end": 74,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 51,
"end": 67,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 52,
"end": 66,
"ctxt": 0
},
"expression": {
"type": "NullLiteral",
"span": {
"start": 52,
"end": 56,
"ctxt": 0
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 60,
"end": 66,
"ctxt": 0
},
"kind": "string"
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"value": "length",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 76,
"end": 106,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 80,
"end": 105,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 84,
"end": 105,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 84,
"end": 95,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
},
"value": "Date",
"optional": false
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 92,
"end": 95,
"ctxt": 0
},
"kind": "any"
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"kind": "string"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 191,
"end": 219,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 195,
"end": 218,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 199,
"end": 218,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 199,
"end": 201,
"ctxt": 0
},
"value": 32.0,
"raw": "32"
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 205,
"end": 218,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 205,
"end": 211,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 212,
"end": 218,
"ctxt": 0
},
"kind": "string"
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 220,
"end": 227,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 220,
"end": 226,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 220,
"end": 221,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 224,
"end": 226,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
}
],
"interpreter": null
}