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

1018 lines
26 KiB
JSON

{
"type": "Module",
"span": {
"start": 45,
"end": 502,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 45,
"end": 93,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 58,
"end": 60,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"declare": false,
"span": {
"start": 52,
"end": 93,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 64,
"end": 72,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 64,
"end": 66,
"ctxt": 0
},
"value": "m1",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 69,
"end": 71,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 74,
"end": 91,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 81,
"end": 83,
"ctxt": 0
},
"value": "s1",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 86,
"end": 90,
"ctxt": 0
},
"value": true
},
"typeAnnotation": null,
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 95,
"end": 147,
"ctxt": 0
},
"declaration": {
"type": "TsInterfaceDeclaration",
"span": {
"start": 102,
"end": 147,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 112,
"end": 114,
"ctxt": 0
},
"value": "I1",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 115,
"end": 147,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 118,
"end": 131,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 118,
"end": 122,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 122,
"end": 130,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 124,
"end": 130,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 133,
"end": 145,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 133,
"end": 136,
"ctxt": 0
},
"value": "age",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 136,
"end": 144,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 138,
"end": 144,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 149,
"end": 210,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 156,
"end": 210,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 163,
"end": 165,
"ctxt": 0
},
"value": "M1",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 166,
"end": 210,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 169,
"end": 208,
"ctxt": 0
},
"declaration": {
"type": "TsInterfaceDeclaration",
"span": {
"start": 176,
"end": 208,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 186,
"end": 188,
"ctxt": 0
},
"value": "I2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 189,
"end": 208,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 193,
"end": 205,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 196,
"end": 204,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 198,
"end": 204,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 212,
"end": 237,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 219,
"end": 237,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 224,
"end": 226,
"ctxt": 0
},
"value": "E1",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "C",
"optional": false
},
"init": null
}
]
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 262,
"end": 294,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 269,
"end": 272,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 275,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 283,
"end": 292,
"ctxt": 0
},
"value": "./foo_0",
"raw": "\"./foo_0\""
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 359,
"end": 377,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "f",
"optional": false
},
"moduleRef": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 370,
"end": 373,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 374,
"end": 376,
"ctxt": 0
},
"value": "M1",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 378,
"end": 390,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 382,
"end": 389,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 382,
"end": 383,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 383,
"end": 389,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 385,
"end": 389,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": "f",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 387,
"end": 389,
"ctxt": 0
},
"value": "I2",
"optional": false
}
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 391,
"end": 424,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 395,
"end": 423,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 396,
"end": 404,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 398,
"end": 404,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 402,
"end": 404,
"ctxt": 0
},
"value": "C1",
"optional": false
}
},
"typeParams": null
}
}
},
"init": {
"type": "TsTypeAssertion",
"span": {
"start": 407,
"end": 423,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 421,
"end": 423,
"ctxt": 0
},
"properties": []
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 408,
"end": 420,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 409,
"end": 419,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 409,
"end": 411,
"ctxt": 0
},
"value": "m1",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 411,
"end": 419,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 413,
"end": 419,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 425,
"end": 457,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 429,
"end": 456,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 429,
"end": 430,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 430,
"end": 448,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 432,
"end": 448,
"ctxt": 0
},
"exprName": {
"type": "TsQualifiedName",
"left": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 439,
"end": 442,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 443,
"end": 445,
"ctxt": 0
},
"value": "C1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 446,
"end": 448,
"ctxt": 0
},
"value": "s1",
"optional": false
}
},
"typeArguments": null
}
}
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 451,
"end": 456,
"ctxt": 0
},
"value": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 458,
"end": 475,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 462,
"end": 474,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 462,
"end": 463,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 463,
"end": 474,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 465,
"end": 474,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 465,
"end": 468,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 469,
"end": 471,
"ctxt": 0
},
"value": "M1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 472,
"end": 474,
"ctxt": 0
},
"value": "I2",
"optional": false
}
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 476,
"end": 502,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 480,
"end": 501,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 480,
"end": 481,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 481,
"end": 489,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 483,
"end": 489,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "TsTypeAssertion",
"span": {
"start": 492,
"end": 501,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 500,
"end": 501,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 493,
"end": 499,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 493,
"end": 496,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 497,
"end": 499,
"ctxt": 0
},
"value": "E1",
"optional": false
}
},
"typeParams": null
}
},
"definite": false
}
]
}
],
"interpreter": null
}