swc/crates/swc_ecma_parser/tests/tsc/stringLiteralsAssertionsInEqualityComparisons02.json
2022-03-22 07:54:08 +00:00

466 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 203,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 0,
"end": 53,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 19,
"ctxt": 0
},
"value": "EnhancedString",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 22,
"end": 52,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 22,
"end": 28,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 31,
"end": 52,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 33,
"end": 50,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 33,
"end": 45,
"ctxt": 0
},
"value": "enhancements",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 45,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"kind": "any"
}
},
"typeParams": null
}
]
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 55,
"end": 88,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 59,
"end": 87,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 63,
"end": 87,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 63,
"end": 68,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "TsAsExpression",
"span": {
"start": 73,
"end": 87,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 73,
"end": 78,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 82,
"end": 87,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 82,
"end": 87,
"ctxt": 0
},
"value": "baz",
"raw": "\"baz\""
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 89,
"end": 124,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 93,
"end": 123,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 97,
"end": 123,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 97,
"end": 102,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 107,
"end": 123,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 108,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 108,
"end": 113,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 117,
"end": 122,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 117,
"end": 122,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 125,
"end": 158,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 129,
"end": 157,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 133,
"end": 157,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 133,
"end": 138,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 142,
"end": 157,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 143,
"end": 156,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 151,
"end": 156,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 159,
"end": 203,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 163,
"end": 202,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 167,
"end": 202,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 167,
"end": 172,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 177,
"end": 202,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 178,
"end": 201,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 178,
"end": 183,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 187,
"end": 201,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 187,
"end": 201,
"ctxt": 0
},
"value": "EnhancedString",
"optional": false
},
"typeParams": null
}
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}