swc/crates/swc_ecma_parser/tests/tsc/genericInstantiationEquivalentToObjectLiteral.json
2022-02-04 20:17:42 +09:00

1040 lines
26 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 259,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 0,
"end": 49,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 10,
"end": 14,
"ctxt": 0
},
"value": "Pair",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 14,
"end": 22,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 15,
"end": 17,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 15,
"end": 17,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 19,
"end": 21,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 19,
"end": 21,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 23,
"end": 49,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 25,
"end": 35,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 25,
"end": 30,
"ctxt": 0
},
"value": "first",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 30,
"end": 34,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 32,
"end": 34,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 32,
"end": 34,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 36,
"end": 47,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"value": "second",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 46,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 44,
"end": 46,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 44,
"end": 46,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 50,
"end": 77,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 54,
"end": 77,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 54,
"end": 55,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 55,
"end": 77,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 57,
"end": 77,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 57,
"end": 61,
"ctxt": 0
},
"value": "Pair",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 61,
"end": 77,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 62,
"end": 68,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 70,
"end": 76,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 78,
"end": 119,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 82,
"end": 119,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 119,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 85,
"end": 119,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 87,
"end": 101,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 87,
"end": 92,
"ctxt": 0
},
"value": "first",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 92,
"end": 100,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 94,
"end": 100,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 102,
"end": 117,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 102,
"end": 108,
"ctxt": 0
},
"value": "second",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 116,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 121,
"end": 127,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 121,
"end": 126,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 128,
"end": 134,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 128,
"end": 133,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 161,
"end": 174,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 161,
"end": 174,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 162,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 164,
"end": 174,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 164,
"end": 168,
"ctxt": 0
},
"value": "Pair",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 169,
"end": 170,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 169,
"end": 170,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 136,
"end": 176,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"value": "U",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 194,
"end": 196,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 203,
"end": 230,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 203,
"end": 230,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 204,
"end": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 206,
"end": 230,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 208,
"end": 217,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 208,
"end": 213,
"ctxt": 0
},
"value": "first",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 218,
"end": 228,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 218,
"end": 224,
"ctxt": 0
},
"value": "second",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 224,
"end": 227,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 177,
"end": 232,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 196,
"end": 202,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 200,
"end": 201,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 200,
"end": 201,
"ctxt": 0
},
"value": "U",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 234,
"end": 239,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 234,
"end": 238,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 240,
"end": 245,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 240,
"end": 244,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 246,
"end": 252,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 246,
"end": 251,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 246,
"end": 248,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 253,
"end": 259,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 253,
"end": 258,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 253,
"end": 255,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 256,
"end": 257,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}