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

200 lines
5.8 KiB
JSON

{
"type": "Script",
"span": {
"start": 16,
"end": 76,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 16,
"end": 76,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 20,
"end": 75,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 20,
"end": 24,
"ctxt": 0
},
"value": "iter",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 24,
"end": 57,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 26,
"end": 57,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 26,
"end": 34,
"ctxt": 0
},
"value": "Iterable",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 34,
"end": 57,
"ctxt": 0
},
"params": [
{
"type": "TsFunctionType",
"span": {
"start": 35,
"end": 56,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 45,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 47,
"end": 56,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 50,
"end": 56,
"ctxt": 0
},
"kind": "number"
}
}
}
]
}
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 60,
"end": 75,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 61,
"end": 74,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "MemberExpression",
"span": {
"start": 66,
"end": 74,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "s",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"value": "length",
"optional": false
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}