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

627 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 424,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 1,
"end": 83,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "StringLiteral",
"span": {
"start": 16,
"end": 31,
"ctxt": 0
},
"value": "ambientModule",
"raw": "\"ambientModule\""
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 32,
"end": 83,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 38,
"end": 57,
"ctxt": 0
},
"declaration": {
"type": "TsTypeAliasDeclaration",
"span": {
"start": 45,
"end": 57,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 50,
"end": 53,
"ctxt": 0
},
"value": "typ",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 62,
"end": 81,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 69,
"end": 81,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 73,
"end": 81,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 76,
"ctxt": 0
},
"value": "val",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 76,
"end": 81,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 78,
"end": 81,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 78,
"end": 81,
"ctxt": 0
},
"value": "typ",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 84,
"end": 128,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 94,
"end": 105,
"ctxt": 0
},
"value": "valueModule",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 106,
"end": 128,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 108,
"end": 126,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 126,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 119,
"end": 126,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 119,
"end": 122,
"ctxt": 0
},
"value": "val",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"definite": false
}
]
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 129,
"end": 178,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 139,
"end": 154,
"ctxt": 0
},
"value": "namespaceModule",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 155,
"end": 178,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 157,
"end": 176,
"ctxt": 0
},
"declaration": {
"type": "TsTypeAliasDeclaration",
"span": {
"start": 164,
"end": 176,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 169,
"end": 172,
"ctxt": 0
},
"value": "typ",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 195,
"end": 253,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 200,
"end": 210,
"ctxt": 0
},
"value": "GlobalBad1",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 213,
"end": 253,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsParenthesizedType",
"span": {
"start": 213,
"end": 232,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 214,
"end": 231,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 221,
"end": 231,
"ctxt": 0
},
"value": "globalThis",
"optional": false
},
"typeArguments": null
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 233,
"end": 252,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 233,
"end": 252,
"ctxt": 0
},
"value": "\"ambientModule\"",
"raw": "\"\\\"ambientModule\\\"\""
}
}
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 254,
"end": 305,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 259,
"end": 268,
"ctxt": 0
},
"value": "GlobalOk1",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 271,
"end": 305,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsParenthesizedType",
"span": {
"start": 271,
"end": 290,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 272,
"end": 289,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 279,
"end": 289,
"ctxt": 0
},
"value": "globalThis",
"optional": false
},
"typeArguments": null
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 291,
"end": 304,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 291,
"end": 304,
"ctxt": 0
},
"value": "valueModule",
"raw": "\"valueModule\""
}
}
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 306,
"end": 353,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 311,
"end": 320,
"ctxt": 0
},
"value": "GlobalOk2",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 323,
"end": 353,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 323,
"end": 333,
"ctxt": 0
},
"value": "globalThis",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 334,
"end": 349,
"ctxt": 0
},
"value": "namespaceModule",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 350,
"end": 353,
"ctxt": 0
},
"value": "typ",
"optional": false
}
},
"typeParams": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 354,
"end": 424,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 360,
"end": 424,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 360,
"end": 364,
"ctxt": 0
},
"value": "bad1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 364,
"end": 406,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 366,
"end": 406,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsParenthesizedType",
"span": {
"start": 366,
"end": 385,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 367,
"end": 384,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 374,
"end": 384,
"ctxt": 0
},
"value": "globalThis",
"optional": false
},
"typeArguments": null
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 386,
"end": 405,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 386,
"end": 405,
"ctxt": 0
},
"value": "\"ambientModule\"",
"raw": "\"\\\"ambientModule\\\"\""
}
}
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 409,
"end": 424,
"ctxt": 0
},
"value": "ambientModule",
"raw": "'ambientModule'"
},
"definite": false
}
]
}
],
"interpreter": null
}