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

561 lines
14 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 23,
"end": 255,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 23,
"end": 51,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 27,
"end": 50,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 27,
"end": 28,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 28,
"end": 45,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 30,
"end": 45,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 30,
"end": 36,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsKeywordType",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"kind": "string"
}
]
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 48,
"end": 50,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 61,
"end": 89,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 65,
"end": 88,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 66,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 68,
"end": 83,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsKeywordType",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"kind": "string"
}
]
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 86,
"end": 88,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 96,
"end": 121,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 100,
"end": 120,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 100,
"end": 101,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 101,
"end": 114,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 103,
"end": 114,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 103,
"end": 109,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 112,
"end": 114,
"ctxt": 0
},
"members": []
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 117,
"end": 120,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 131,
"end": 137,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 131,
"end": 136,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 135,
"end": 136,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 147,
"end": 153,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 147,
"end": 152,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 161,
"end": 199,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 167,
"end": 198,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 167,
"end": 170,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 170,
"end": 183,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 172,
"end": 183,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 172,
"end": 178,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 181,
"end": 183,
"ctxt": 0
},
"members": []
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 186,
"end": 198,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 187,
"end": 190,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 192,
"end": 197,
"ctxt": 0
},
"value": "bar",
"raw": "'bar'"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 206,
"end": 255,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 212,
"end": 254,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 212,
"end": 215,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 215,
"end": 239,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 217,
"end": 239,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 217,
"end": 223,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 226,
"end": 239,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 227,
"end": 238,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 227,
"end": 230,
"ctxt": 0
},
"value": "err",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 230,
"end": 238,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 232,
"end": 238,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 242,
"end": 254,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 248,
"end": 253,
"ctxt": 0
},
"value": "bar",
"raw": "'bar'"
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}