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

262 lines
6.2 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 103,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 35,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 34,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 6,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 9,
"end": 34,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 9,
"end": 14,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "TsAsExpression",
"span": {
"start": 19,
"end": 34,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 19,
"end": 24,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 28,
"end": 34,
"ctxt": 0
},
"kind": "string"
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 36,
"end": 72,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 40,
"end": 71,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 40,
"end": 41,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 44,
"end": 71,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 44,
"end": 49,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 54,
"end": 71,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 55,
"end": 70,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 55,
"end": 60,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 70,
"ctxt": 0
},
"kind": "string"
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 73,
"end": 103,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 77,
"end": 102,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 81,
"end": 102,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 81,
"end": 86,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 90,
"end": 102,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 91,
"end": 101,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 96,
"end": 101,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 92,
"end": 95,
"ctxt": 0
},
"kind": "any"
}
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}