swc/crates/swc_ecma_parser/tests/tsc/assignFromNumberInterface2.json
2022-04-05 12:46:35 +00:00

854 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 407,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 0,
"end": 43,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 10,
"end": 16,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 17,
"end": 43,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 23,
"end": 41,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 23,
"end": 30,
"ctxt": 0
},
"value": "doStuff",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 40,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 34,
"end": 40,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 45,
"end": 295,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 64,
"ctxt": 0
},
"value": "NotNumber",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 65,
"end": 295,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 71,
"end": 104,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 71,
"end": 79,
"ctxt": 0
},
"value": "toString",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 80,
"end": 94,
"ctxt": 0
},
"value": "radix",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 86,
"end": 94,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 88,
"end": 94,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 95,
"end": 103,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 97,
"end": 103,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 109,
"end": 150,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 109,
"end": 116,
"ctxt": 0
},
"value": "toFixed",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 117,
"end": 140,
"ctxt": 0
},
"value": "fractionDigits",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 132,
"end": 140,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 134,
"end": 140,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 141,
"end": 149,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 155,
"end": 202,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 155,
"end": 168,
"ctxt": 0
},
"value": "toExponential",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 169,
"end": 192,
"ctxt": 0
},
"value": "fractionDigits",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 184,
"end": 192,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 186,
"end": 192,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 193,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 195,
"end": 201,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 207,
"end": 247,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 207,
"end": 218,
"ctxt": 0
},
"value": "toPrecision",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 219,
"end": 237,
"ctxt": 0
},
"value": "precision",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 229,
"end": 237,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 231,
"end": 237,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 238,
"end": 246,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 240,
"end": 246,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 252,
"end": 270,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 252,
"end": 259,
"ctxt": 0
},
"value": "valueOf",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 261,
"end": 269,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 263,
"end": 269,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 275,
"end": 293,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 275,
"end": 282,
"ctxt": 0
},
"value": "doStuff",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 284,
"end": 292,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 286,
"end": 292,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 297,
"end": 307,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 301,
"end": 306,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 308,
"end": 322,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 312,
"end": 321,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 313,
"end": 321,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 315,
"end": 321,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 315,
"end": 321,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 323,
"end": 340,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 327,
"end": 339,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 328,
"end": 339,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 330,
"end": 339,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 330,
"end": 339,
"ctxt": 0
},
"value": "NotNumber",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 342,
"end": 348,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 342,
"end": 347,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 342,
"end": 343,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 346,
"end": 347,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 350,
"end": 356,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 350,
"end": 355,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 350,
"end": 351,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 354,
"end": 355,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 359,
"end": 365,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 359,
"end": 364,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 359,
"end": 360,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 367,
"end": 373,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 367,
"end": 372,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 367,
"end": 368,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 371,
"end": 372,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 376,
"end": 382,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 376,
"end": 381,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 376,
"end": 377,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 380,
"end": 381,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 401,
"end": 407,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 401,
"end": 406,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 401,
"end": 402,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 405,
"end": 406,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
],
"interpreter": null
}