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

466 lines
11 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 204,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 1,
"end": 54,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 6,
"end": 20,
"ctxt": 0
},
"value": "EnhancedString",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 23,
"end": 53,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 23,
"end": 29,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 32,
"end": 53,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 34,
"end": 51,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 34,
"end": 46,
"ctxt": 0
},
"value": "enhancements",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 51,
"ctxt": 0
},
"kind": "any"
}
},
"typeParams": null
}
]
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 56,
"end": 89,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 60,
"end": 88,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 60,
"end": 61,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 64,
"end": 88,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "TsAsExpression",
"span": {
"start": 74,
"end": 88,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 74,
"end": 79,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 83,
"end": 88,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 83,
"end": 88,
"ctxt": 0
},
"value": "baz",
"raw": "\"baz\""
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 90,
"end": 125,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 94,
"end": 124,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 98,
"end": 124,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 98,
"end": 103,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 108,
"end": 124,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 109,
"end": 123,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 109,
"end": 114,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 118,
"end": 123,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 118,
"end": 123,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 126,
"end": 159,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 130,
"end": 158,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 134,
"end": 158,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 134,
"end": 139,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 143,
"end": 158,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 144,
"end": 157,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 152,
"end": 157,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 145,
"end": 151,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 160,
"end": 204,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 164,
"end": 203,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 168,
"end": 203,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 168,
"end": 173,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 178,
"end": 203,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 179,
"end": 202,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 179,
"end": 184,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 188,
"end": 202,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 188,
"end": 202,
"ctxt": 0
},
"value": "EnhancedString",
"optional": false
},
"typeParams": null
}
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}