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

1058 lines
27 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 260,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1,
"end": 50,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 11,
"end": 15,
"ctxt": 0
},
"value": "Pair",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 15,
"end": 23,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 16,
"end": 18,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 16,
"end": 18,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 20,
"end": 22,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 20,
"end": 22,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 24,
"end": 50,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 26,
"end": 36,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 26,
"end": 31,
"ctxt": 0
},
"value": "first",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 31,
"end": 35,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 33,
"end": 35,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 33,
"end": 35,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 37,
"end": 48,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 37,
"end": 43,
"ctxt": 0
},
"value": "second",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 47,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 45,
"end": 47,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 45,
"end": 47,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 78,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 78,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 56,
"end": 78,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 58,
"end": 78,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 58,
"end": 62,
"ctxt": 0
},
"value": "Pair",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 62,
"end": 78,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 71,
"end": 77,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 79,
"end": 120,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 83,
"end": 120,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 84,
"end": 120,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 86,
"end": 120,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 88,
"end": 102,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 88,
"end": 93,
"ctxt": 0
},
"value": "first",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 93,
"end": 101,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 95,
"end": 101,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 103,
"end": 118,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 103,
"end": 109,
"ctxt": 0
},
"value": "second",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 109,
"end": 117,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 111,
"end": 117,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 122,
"end": 128,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 122,
"end": 127,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 129,
"end": 135,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 129,
"end": 134,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 162,
"end": 175,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 162,
"end": 175,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 163,
"end": 175,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 165,
"end": 175,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 165,
"end": 169,
"ctxt": 0
},
"value": "Pair",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 169,
"end": 175,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 173,
"end": 174,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 173,
"end": 174,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 137,
"end": 177,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 155,
"end": 161,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 156,
"end": 157,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 156,
"end": 157,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 159,
"end": 160,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 159,
"end": 160,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 195,
"end": 197,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 204,
"end": 231,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 204,
"end": 231,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 205,
"end": 231,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 207,
"end": 231,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 209,
"end": 218,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 209,
"end": 214,
"ctxt": 0
},
"value": "first",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 214,
"end": 217,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 219,
"end": 229,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 219,
"end": 225,
"ctxt": 0
},
"value": "second",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 225,
"end": 228,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 178,
"end": 233,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 197,
"end": 203,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 235,
"end": 240,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 235,
"end": 239,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 237,
"end": 238,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 241,
"end": 246,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 241,
"end": 245,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 243,
"end": 244,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 247,
"end": 253,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 247,
"end": 252,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 247,
"end": 249,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 250,
"end": 251,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 254,
"end": 260,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 254,
"end": 259,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 254,
"end": 256,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 257,
"end": 258,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}