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

576 lines
14 KiB
JSON

{
"type": "Script",
"span": {
"start": 22,
"end": 254,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 22,
"end": 50,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 26,
"end": 49,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 27,
"end": 44,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 29,
"end": 44,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 29,
"end": 35,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsKeywordType",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"kind": "string"
}
]
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 47,
"end": 49,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 60,
"end": 88,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 64,
"end": 87,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 64,
"end": 65,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 65,
"end": 82,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 67,
"end": 82,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 67,
"end": 73,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsKeywordType",
"span": {
"start": 76,
"end": 82,
"ctxt": 0
},
"kind": "string"
}
]
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 85,
"end": 87,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 95,
"end": 120,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 99,
"end": 119,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 100,
"end": 113,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 102,
"end": 113,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 102,
"end": 108,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 111,
"end": 113,
"ctxt": 0
},
"members": []
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 116,
"end": 119,
"ctxt": 0
},
"value": 123.0
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 130,
"end": 136,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 130,
"end": 135,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 152,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 146,
"end": 151,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 150,
"end": 151,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 160,
"end": 198,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 166,
"end": 197,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 166,
"end": 169,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 169,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 171,
"end": 182,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 171,
"end": 177,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 180,
"end": 182,
"ctxt": 0
},
"members": []
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 185,
"end": 197,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 186,
"end": 189,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 191,
"end": 196,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 205,
"end": 254,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 211,
"end": 253,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 214,
"end": 238,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 216,
"end": 238,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 216,
"end": 222,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 225,
"end": 238,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 226,
"end": 237,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 226,
"end": 229,
"ctxt": 0
},
"value": "err",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 229,
"end": 237,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 231,
"end": 237,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 241,
"end": 253,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 242,
"end": 245,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 247,
"end": 252,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}