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

564 lines
13 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 59,
"end": 373,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 59,
"end": 92,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 66,
"end": 92,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 71,
"end": 74,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ImportDeclaration",
"span": {
"start": 116,
"end": 143,
"ctxt": 0
},
"specifiers": [
{
"type": "ImportSpecifier",
"span": {
"start": 124,
"end": 127,
"ctxt": 0
},
"local": {
"type": "Identifier",
"span": {
"start": 124,
"end": 127,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"imported": null,
"isTypeOnly": false
}
],
"source": {
"type": "StringLiteral",
"span": {
"start": 134,
"end": 142,
"ctxt": 0
},
"value": "./enum",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeOnly": false,
"asserts": null
},
{
"type": "TsEnumDeclaration",
"span": {
"start": 145,
"end": 171,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 150,
"end": 153,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": null
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 172,
"end": 197,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 176,
"end": 196,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 176,
"end": 179,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsConstAssertion",
"span": {
"start": 182,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 182,
"end": 187,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 182,
"end": 185,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 198,
"end": 223,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 202,
"end": 222,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 202,
"end": 205,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsConstAssertion",
"span": {
"start": 208,
"end": 222,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 208,
"end": 213,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 208,
"end": 211,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 245,
"end": 310,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 255,
"end": 257,
"ctxt": 0
},
"value": "ns",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 258,
"end": 310,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 264,
"end": 285,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 271,
"end": 285,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 276,
"end": 279,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "X",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 290,
"end": 308,
"ctxt": 0
},
"expression": {
"type": "TsConstAssertion",
"span": {
"start": 290,
"end": 307,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 290,
"end": 298,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 290,
"end": 296,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 290,
"end": 292,
"ctxt": 0
},
"value": "ns",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 293,
"end": 296,
"ctxt": 0
},
"value": "Foo",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "X",
"optional": false
}
}
}
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 334,
"end": 355,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 341,
"end": 355,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 346,
"end": 349,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"value": "X",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 356,
"end": 373,
"ctxt": 0
},
"expression": {
"type": "TsConstAssertion",
"span": {
"start": 356,
"end": 372,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 356,
"end": 363,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 356,
"end": 361,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 357,
"end": 360,
"ctxt": 0
},
"value": "Foo",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 362,
"end": 363,
"ctxt": 0
},
"value": "X",
"optional": false
}
}
}
}
],
"interpreter": null
}