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

560 lines
13 KiB
JSON

{
"type": "Module",
"span": {
"start": 60,
"end": 374,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 60,
"end": 93,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 67,
"end": 93,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 75,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ImportDeclaration",
"span": {
"start": 117,
"end": 144,
"ctxt": 0
},
"specifiers": [
{
"type": "ImportSpecifier",
"span": {
"start": 125,
"end": 128,
"ctxt": 0
},
"local": {
"type": "Identifier",
"span": {
"start": 125,
"end": 128,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"imported": null,
"isTypeOnly": false
}
],
"source": {
"type": "StringLiteral",
"span": {
"start": 135,
"end": 143,
"ctxt": 0
},
"value": "./enum",
"raw": "'./enum'"
},
"typeOnly": false,
"asserts": null
},
{
"type": "TsEnumDeclaration",
"span": {
"start": 146,
"end": 172,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 151,
"end": 154,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": null
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 173,
"end": 198,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 177,
"end": 197,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 177,
"end": 180,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsConstAssertion",
"span": {
"start": 183,
"end": 197,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 183,
"end": 188,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 183,
"end": 186,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 199,
"end": 224,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 203,
"end": 223,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 203,
"end": 206,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsConstAssertion",
"span": {
"start": 209,
"end": 223,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 209,
"end": 214,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 209,
"end": 212,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 246,
"end": 311,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 256,
"end": 258,
"ctxt": 0
},
"value": "ns",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 259,
"end": 311,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 265,
"end": 286,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 272,
"end": 286,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 277,
"end": 280,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "X",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 291,
"end": 309,
"ctxt": 0
},
"expression": {
"type": "TsConstAssertion",
"span": {
"start": 291,
"end": 308,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 291,
"end": 299,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 291,
"end": 297,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 291,
"end": 293,
"ctxt": 0
},
"value": "ns",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 294,
"end": 297,
"ctxt": 0
},
"value": "Foo",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "X",
"optional": false
}
}
}
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 335,
"end": 356,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 342,
"end": 356,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 347,
"end": 350,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": "X",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 357,
"end": 374,
"ctxt": 0
},
"expression": {
"type": "TsConstAssertion",
"span": {
"start": 357,
"end": 373,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 357,
"end": 364,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 357,
"end": 362,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 358,
"end": 361,
"ctxt": 0
},
"value": "Foo",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"value": "X",
"optional": false
}
}
}
}
],
"interpreter": null
}