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

854 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 408,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1,
"end": 44,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 11,
"end": 17,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 18,
"end": 44,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 24,
"end": 42,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 24,
"end": 31,
"ctxt": 0
},
"value": "doStuff",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 41,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 46,
"end": 296,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 65,
"ctxt": 0
},
"value": "NotNumber",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 66,
"end": 296,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 72,
"end": 105,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 72,
"end": 80,
"ctxt": 0
},
"value": "toString",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 81,
"end": 95,
"ctxt": 0
},
"value": "radix",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 87,
"end": 95,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 89,
"end": 95,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 96,
"end": 104,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 98,
"end": 104,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 110,
"end": 151,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 110,
"end": 117,
"ctxt": 0
},
"value": "toFixed",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 118,
"end": 141,
"ctxt": 0
},
"value": "fractionDigits",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 133,
"end": 141,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 135,
"end": 141,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 142,
"end": 150,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 156,
"end": 203,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 156,
"end": 169,
"ctxt": 0
},
"value": "toExponential",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 170,
"end": 193,
"ctxt": 0
},
"value": "fractionDigits",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 185,
"end": 193,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 187,
"end": 193,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 194,
"end": 202,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 196,
"end": 202,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 208,
"end": 248,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 208,
"end": 219,
"ctxt": 0
},
"value": "toPrecision",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 220,
"end": 238,
"ctxt": 0
},
"value": "precision",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 230,
"end": 238,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 232,
"end": 238,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 239,
"end": 247,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 241,
"end": 247,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 253,
"end": 271,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 253,
"end": 260,
"ctxt": 0
},
"value": "valueOf",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 262,
"end": 270,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 264,
"end": 270,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 276,
"end": 294,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 276,
"end": 283,
"ctxt": 0
},
"value": "doStuff",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 285,
"end": 293,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 287,
"end": 293,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 298,
"end": 308,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 302,
"end": 307,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 302,
"end": 303,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 309,
"end": 323,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 313,
"end": 322,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 314,
"end": 322,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 316,
"end": 322,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 316,
"end": 322,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 324,
"end": 341,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 328,
"end": 340,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 329,
"end": 340,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 331,
"end": 340,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 331,
"end": 340,
"ctxt": 0
},
"value": "NotNumber",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 343,
"end": 349,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 343,
"end": 348,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 343,
"end": 344,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 347,
"end": 348,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 351,
"end": 357,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 351,
"end": 356,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 355,
"end": 356,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 360,
"end": 366,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 360,
"end": 365,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 360,
"end": 361,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 364,
"end": 365,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 368,
"end": 374,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 368,
"end": 373,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 368,
"end": 369,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 372,
"end": 373,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 377,
"end": 383,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 377,
"end": 382,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 377,
"end": 378,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 381,
"end": 382,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 402,
"end": 408,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 402,
"end": 407,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 402,
"end": 403,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 406,
"end": 407,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
],
"interpreter": null
}