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

506 lines
13 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
2022-02-04 14:17:42 +03:00
"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": {
2022-02-04 14:17:42 +03:00
"start": 55,
"end": 88,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 59,
"end": 87,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 59,
"end": 60,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 63,
"end": 87,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 63,
"end": 68,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "TsAsExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 73,
"end": 87,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 73,
"end": 78,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 82,
"end": 87,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 82,
"end": 87,
"ctxt": 0
},
"value": "baz",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 89,
"end": 124,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 93,
"end": 123,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 97,
"end": 123,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 97,
"end": 102,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "ParenthesisExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 107,
"end": 123,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 108,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 108,
"end": 113,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 117,
"end": 122,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 117,
"end": 122,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 125,
"end": 158,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 129,
"end": 157,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 133,
"end": 157,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 133,
"end": 138,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "ParenthesisExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 142,
"end": 157,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
2022-02-04 14:17:42 +03:00
"start": 143,
"end": 156,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 151,
"end": 156,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 144,
"end": 150,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 159,
"end": 203,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 163,
"end": 202,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 163,
"end": 164,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 167,
"end": 202,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 167,
"end": 172,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "ParenthesisExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 177,
"end": 202,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 178,
"end": 201,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 178,
"end": 183,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
2022-02-04 14:17:42 +03:00
"start": 187,
"end": 201,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 187,
"end": 201,
"ctxt": 0
},
"value": "EnhancedString",
"optional": false
},
"typeParams": null
}
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}