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

299 lines
6.9 KiB
JSON

{
"type": "Script",
"span": {
"start": 24,
"end": 108,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 62,
"end": 66,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 62,
"end": 66,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 24,
"end": 71,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 44,
"end": 61,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 45,
"end": 60,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 45,
"end": 46,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTupleType",
"span": {
"start": 55,
"end": 60,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"kind": "any"
}
}
]
},
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 67,
"end": 70,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 73,
"end": 98,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 77,
"end": 97,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 81,
"end": 97,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 81,
"end": 84,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 85,
"end": 96,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 86,
"end": 95,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 99,
"end": 108,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 99,
"end": 107,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 103,
"end": 107,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 104,
"end": 106,
"ctxt": 0
},
"value": "",
"raw": "\"\""
}
}
]
}
}
}
],
"interpreter": null
}