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

743 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 28,
"end": 259,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 28,
"end": 42,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 32,
"end": 41,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 32,
"end": 34,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NullLiteral",
"span": {
"start": 37,
"end": 41,
"ctxt": 0
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 43,
"end": 62,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 47,
"end": 61,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 47,
"end": 49,
"ctxt": 0
},
"value": "a2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "Identifier",
"span": {
"start": 52,
"end": 61,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 63,
"end": 79,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 67,
"end": 78,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 67,
"end": 69,
"ctxt": 0
},
"value": "a3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "UnaryExpression",
"span": {
"start": 72,
"end": 78,
"ctxt": 0
},
"operator": "void",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 81,
"end": 93,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 85,
"end": 92,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 85,
"end": 87,
"ctxt": 0
},
"value": "b1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 90,
"end": 92,
"ctxt": 0
},
"elements": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 94,
"end": 107,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 98,
"end": 106,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 98,
"end": 100,
"ctxt": 0
},
"value": "b2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"elements": [
null
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 108,
"end": 129,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 112,
"end": 128,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 112,
"end": 114,
"ctxt": 0
},
"value": "b3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 117,
"end": 128,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 118,
"end": 127,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 130,
"end": 148,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 134,
"end": 147,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 134,
"end": 136,
"ctxt": 0
},
"value": "b4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 139,
"end": 147,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 140,
"end": 142,
"ctxt": 0
},
"elements": []
}
},
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 144,
"end": 146,
"ctxt": 0
},
"elements": []
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 149,
"end": 168,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 153,
"end": 167,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 153,
"end": 155,
"ctxt": 0
},
"value": "b5",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 158,
"end": 167,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 159,
"end": 161,
"ctxt": 0
},
"elements": []
}
},
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"elements": [
null
]
}
}
]
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 192,
"end": 196,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 192,
"end": 196,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 170,
"end": 201,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 188,
"end": 191,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 197,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 203,
"end": 220,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 207,
"end": 219,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 207,
"end": 209,
"ctxt": 0
},
"value": "c1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 212,
"end": 219,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NullLiteral",
"span": {
"start": 214,
"end": 218,
"ctxt": 0
}
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 221,
"end": 243,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 225,
"end": 242,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 225,
"end": 227,
"ctxt": 0
},
"value": "c2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 230,
"end": 242,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 232,
"end": 241,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 244,
"end": 259,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 248,
"end": 258,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 248,
"end": 250,
"ctxt": 0
},
"value": "c3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 253,
"end": 258,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 253,
"end": 254,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 255,
"end": 257,
"ctxt": 0
},
"elements": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}