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

916 lines
23 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
2022-02-04 14:17:42 +03:00
"end": 344,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 9,
"end": 12,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 13,
"end": 14,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 13,
"end": 14,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 0,
"end": 29,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 16,
"end": 29,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 18,
"end": 27,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 30,
"end": 67,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 34,
"end": 67,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 34,
"end": 35,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "FunctionExpression",
"identifier": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 47,
"end": 50,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
2022-02-04 14:17:42 +03:00
"start": 51,
"end": 52,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
2022-02-04 14:17:42 +03:00
"start": 38,
"end": 67,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 54,
"end": 67,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 56,
"end": 65,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 63,
"end": 64,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 68,
"end": 86,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 72,
"end": 85,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 72,
"end": 74,
"ctxt": 0
},
"value": "f2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 77,
"end": 85,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "x",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 87,
"end": 108,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 91,
"end": 107,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 91,
"end": 93,
"ctxt": 0
},
"value": "f3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 96,
"end": 107,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 100,
"end": 101,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 106,
"end": 107,
"ctxt": 0
},
"value": "x",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 96,
"end": 99,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
2022-02-04 14:17:42 +03:00
"start": 97,
"end": 98,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 116,
"end": 117,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
2022-02-04 14:17:42 +03:00
"start": 110,
"end": 158,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
2022-02-04 14:17:42 +03:00
"start": 124,
"end": 156,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 124,
"end": 127,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
2022-02-04 14:17:42 +03:00
"start": 128,
"end": 129,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
2022-02-04 14:17:42 +03:00
"start": 124,
"end": 156,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 131,
"end": 156,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 141,
"end": 150,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsInterfaceDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 160,
"end": 203,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
2022-02-04 14:17:42 +03:00
"start": 172,
"end": 203,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
2022-02-04 14:17:42 +03:00
"start": 178,
"end": 185,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 178,
"end": 181,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"typeAnn": null,
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
2022-02-04 14:17:42 +03:00
"start": 190,
"end": 201,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 190,
"end": 194,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
],
"typeAnn": null,
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 205,
"end": 227,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 209,
"end": 227,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 210,
"end": 227,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 212,
"end": 227,
"ctxt": 0
},
"members": [
{
"type": "TsMethodSignature",
"span": {
2022-02-04 14:17:42 +03:00
"start": 218,
"end": 225,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 218,
"end": 221,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 222,
"end": 223,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"typeAnn": null,
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 229,
"end": 344,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 233,
"end": 344,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 237,
"end": 344,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
2022-02-04 14:17:42 +03:00
"start": 247,
"end": 248,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 247,
"end": 248,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
2022-02-04 14:17:42 +03:00
"start": 243,
"end": 275,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 250,
"end": 275,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 260,
"end": 269,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 267,
"end": 268,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 281,
"end": 282,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "FunctionExpression",
"identifier": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 293,
"end": 296,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
2022-02-04 14:17:42 +03:00
"start": 297,
"end": 298,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
2022-02-04 14:17:42 +03:00
"start": 284,
"end": 325,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 300,
"end": 325,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 310,
"end": 319,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 317,
"end": 318,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 331,
"end": 332,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 334,
"end": 342,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 335,
"end": 336,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 341,
"end": 342,
"ctxt": 0
},
"value": "x",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}