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

4486 lines
116 KiB
JSON

{
"type": "Script",
"span": {
"start": 41,
"end": 1966,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 41,
"end": 86,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 53,
"end": 86,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 55,
"end": 84,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 55,
"end": 81,
"ctxt": 0
},
"value": "i am a very certain type",
"raw": "'i am a very certain type'"
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 81,
"end": 84,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 87,
"end": 111,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 91,
"end": 110,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 92,
"end": 95,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "TsTypeAssertion",
"span": {
"start": 98,
"end": 110,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 101,
"end": 110,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"typeParams": null
}
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 121,
"end": 132,
"ctxt": 0
},
"value": "destructure",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 144,
"end": 160,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 144,
"end": 160,
"ctxt": 0
},
"value": "something",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 153,
"end": 160,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 155,
"end": 160,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 159,
"end": 160,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 159,
"end": 160,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"typeParams": null
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 166,
"end": 192,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 166,
"end": 192,
"ctxt": 0
},
"value": "haveValue",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 175,
"end": 192,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 177,
"end": 192,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 178,
"end": 186,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 183,
"end": 186,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 188,
"end": 192,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "r",
"optional": false
},
"typeParams": null
}
}
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 198,
"end": 220,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 198,
"end": 220,
"ctxt": 0
},
"value": "haveY",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 203,
"end": 220,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 205,
"end": 220,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 206,
"end": 214,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 216,
"end": 220,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"value": "r",
"optional": false
},
"typeParams": null
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 112,
"end": 294,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 226,
"end": 294,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 232,
"end": 292,
"ctxt": 0
},
"argument": {
"type": "ConditionalExpression",
"span": {
"start": 239,
"end": 291,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 239,
"end": 254,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 239,
"end": 248,
"ctxt": 0
},
"value": "something",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 253,
"end": 254,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"consequent": {
"type": "CallExpression",
"span": {
"start": 257,
"end": 265,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 257,
"end": 262,
"ctxt": 0
},
"value": "haveY",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
],
"typeArguments": null
},
"alternate": {
"type": "CallExpression",
"span": {
"start": 268,
"end": 291,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 268,
"end": 277,
"ctxt": 0
},
"value": "haveValue",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 278,
"end": 290,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 281,
"end": 290,
"ctxt": 0
},
"value": "something",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 279,
"end": 280,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 279,
"end": 280,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
}
}
}
],
"typeArguments": null
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 132,
"end": 138,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"value": "a",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "r",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 222,
"end": 225,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "r",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 296,
"end": 352,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 300,
"end": 351,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 300,
"end": 305,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ConditionalExpression",
"span": {
"start": 308,
"end": 351,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 308,
"end": 327,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "CallExpression",
"span": {
"start": 308,
"end": 321,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 308,
"end": 319,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 308,
"end": 312,
"ctxt": 0
},
"value": "Math",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 313,
"end": 319,
"ctxt": 0
},
"value": "random",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 324,
"end": 327,
"ctxt": 0
},
"value": 0.5,
"raw": "0.5"
}
},
"consequent": {
"type": "StringLiteral",
"span": {
"start": 330,
"end": 336,
"ctxt": 0
},
"value": "hey!",
"raw": "'hey!'"
},
"alternate": {
"type": "TsTypeAssertion",
"span": {
"start": 339,
"end": 351,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 342,
"end": 351,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 340,
"end": 341,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 340,
"end": 341,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"typeParams": null
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 354,
"end": 422,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 358,
"end": 421,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 358,
"end": 364,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 367,
"end": 421,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 367,
"end": 378,
"ctxt": 0
},
"value": "destructure",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 379,
"end": 384,
"ctxt": 0
},
"value": "value",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 386,
"end": 402,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 386,
"end": 390,
"ctxt": 0
},
"value": "text",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "StringLiteral",
"span": {
"start": 394,
"end": 402,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 404,
"end": 420,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "StringLiteral",
"span": {
"start": 409,
"end": 420,
"ctxt": 0
},
"value": "other one",
"raw": "'other one'"
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 476,
"end": 482,
"ctxt": 0
},
"value": "isVoid",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 486,
"end": 501,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 486,
"end": 501,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 491,
"end": 501,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 493,
"end": 501,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 493,
"end": 497,
"ctxt": 0
},
"kind": "void"
},
{
"type": "TsTypeReference",
"span": {
"start": 500,
"end": 501,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 500,
"end": 501,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 467,
"end": 543,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 518,
"end": 543,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 524,
"end": 541,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 531,
"end": 540,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 482,
"end": 485,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 483,
"end": 484,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 483,
"end": 484,
"ctxt": 0
},
"value": "a",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 502,
"end": 517,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypePredicate",
"span": {
"start": 504,
"end": 517,
"ctxt": 0
},
"asserts": false,
"paramName": {
"type": "Identifier",
"span": {
"start": 504,
"end": 509,
"ctxt": 0
},
"value": "value",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 513,
"end": 517,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 513,
"end": 517,
"ctxt": 0
},
"kind": "void"
}
}
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 554,
"end": 563,
"ctxt": 0
},
"value": "isNonVoid",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 567,
"end": 582,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 567,
"end": 582,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 572,
"end": 582,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 574,
"end": 582,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 574,
"end": 578,
"ctxt": 0
},
"kind": "void"
},
{
"type": "TsTypeReference",
"span": {
"start": 581,
"end": 582,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 581,
"end": 582,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 545,
"end": 622,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 597,
"end": 622,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 603,
"end": 620,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 610,
"end": 619,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 563,
"end": 566,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 564,
"end": 565,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 564,
"end": 565,
"ctxt": 0
},
"value": "a",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 584,
"end": 596,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypePredicate",
"span": {
"start": 586,
"end": 596,
"ctxt": 0
},
"asserts": false,
"paramName": {
"type": "Identifier",
"span": {
"start": 586,
"end": 591,
"ctxt": 0
},
"value": "value",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 595,
"end": 596,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 595,
"end": 596,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 595,
"end": 596,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
}
}
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 633,
"end": 637,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 641,
"end": 654,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 641,
"end": 654,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 646,
"end": 654,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 648,
"end": 654,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 648,
"end": 652,
"ctxt": 0
},
"kind": "void"
},
{
"type": "TsTypeReference",
"span": {
"start": 653,
"end": 654,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 653,
"end": 654,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 624,
"end": 770,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 662,
"end": 770,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 668,
"end": 768,
"ctxt": 0
},
"test": {
"type": "CallExpression",
"span": {
"start": 672,
"end": 685,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 672,
"end": 678,
"ctxt": 0
},
"value": "isVoid",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 679,
"end": 684,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
],
"typeArguments": null
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 687,
"end": 726,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 697,
"end": 703,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 697,
"end": 702,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 732,
"end": 768,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 742,
"end": 748,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 742,
"end": 747,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 637,
"end": 640,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 638,
"end": 639,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 638,
"end": 639,
"ctxt": 0
},
"value": "a",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 655,
"end": 661,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 657,
"end": 661,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 781,
"end": 785,
"ctxt": 0
},
"value": "baz1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 789,
"end": 802,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 789,
"end": 802,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 794,
"end": 802,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 796,
"end": 802,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 796,
"end": 800,
"ctxt": 0
},
"kind": "void"
},
{
"type": "TsTypeReference",
"span": {
"start": 801,
"end": 802,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 801,
"end": 802,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 772,
"end": 931,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 810,
"end": 931,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 818,
"end": 929,
"ctxt": 0
},
"test": {
"type": "CallExpression",
"span": {
"start": 822,
"end": 838,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 822,
"end": 831,
"ctxt": 0
},
"value": "isNonVoid",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 832,
"end": 837,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
],
"typeArguments": null
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 840,
"end": 880,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 852,
"end": 858,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 852,
"end": 857,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 886,
"end": 929,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 898,
"end": 904,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 898,
"end": 903,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 785,
"end": 788,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 786,
"end": 787,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 786,
"end": 787,
"ctxt": 0
},
"value": "a",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 803,
"end": 809,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 805,
"end": 809,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 954,
"end": 979,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 959,
"end": 964,
"ctxt": 0
},
"value": "Maybe",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 964,
"end": 967,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 965,
"end": 966,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 965,
"end": 966,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 970,
"end": 978,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 970,
"end": 971,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 970,
"end": 971,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 974,
"end": 978,
"ctxt": 0
},
"kind": "void"
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 990,
"end": 993,
"ctxt": 0
},
"value": "get",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 997,
"end": 1008,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 997,
"end": 1008,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 998,
"end": 1008,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1000,
"end": 1008,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1000,
"end": 1001,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1000,
"end": 1001,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 1004,
"end": 1008,
"ctxt": 0
},
"kind": "void"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 981,
"end": 1051,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1013,
"end": 1051,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1018,
"end": 1030,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 1025,
"end": 1029,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 993,
"end": 996,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 994,
"end": 995,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 994,
"end": 995,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1009,
"end": 1012,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1011,
"end": 1012,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1011,
"end": 1012,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 1053,
"end": 1076,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1057,
"end": 1075,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1057,
"end": 1060,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1060,
"end": 1075,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1062,
"end": 1075,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1062,
"end": 1067,
"ctxt": 0
},
"value": "Maybe",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1067,
"end": 1075,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 1068,
"end": 1074,
"ctxt": 0
},
"kind": "string"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 1077,
"end": 1100,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 1077,
"end": 1099,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 1077,
"end": 1097,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 1077,
"end": 1085,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1077,
"end": 1080,
"ctxt": 0
},
"value": "get",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1081,
"end": 1084,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 1086,
"end": 1097,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1129,
"end": 1166,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1139,
"end": 1142,
"ctxt": 0
},
"value": "Man",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1143,
"end": 1166,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 1149,
"end": 1164,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 1149,
"end": 1154,
"ctxt": 0
},
"value": "walks",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1154,
"end": 1163,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1156,
"end": 1163,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1168,
"end": 1206,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1178,
"end": 1182,
"ctxt": 0
},
"value": "Bear",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1183,
"end": 1206,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 1189,
"end": 1204,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 1189,
"end": 1194,
"ctxt": 0
},
"value": "roars",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1194,
"end": 1203,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1196,
"end": 1203,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1208,
"end": 1245,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1218,
"end": 1221,
"ctxt": 0
},
"value": "Pig",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1222,
"end": 1245,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 1228,
"end": 1243,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 1228,
"end": 1233,
"ctxt": 0
},
"value": "oinks",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1233,
"end": 1242,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1235,
"end": 1242,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1264,
"end": 1270,
"ctxt": 0
},
"value": "pigify",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 1274,
"end": 1285,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1274,
"end": 1285,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1275,
"end": 1285,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 1277,
"end": 1285,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1277,
"end": 1278,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1277,
"end": 1278,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1281,
"end": 1285,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1281,
"end": 1285,
"ctxt": 0
},
"value": "Bear",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 1247,
"end": 1296,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1270,
"end": 1273,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1271,
"end": 1272,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1271,
"end": 1272,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1286,
"end": 1295,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 1288,
"end": 1295,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1288,
"end": 1289,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1288,
"end": 1289,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1292,
"end": 1295,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1292,
"end": 1295,
"ctxt": 0
},
"value": "Pig",
"optional": false
},
"typeParams": null
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 1297,
"end": 1325,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1309,
"end": 1324,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1309,
"end": 1312,
"ctxt": 0
},
"value": "mbp",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1312,
"end": 1324,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 1314,
"end": 1324,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1314,
"end": 1317,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1314,
"end": 1317,
"ctxt": 0
},
"value": "Man",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1320,
"end": 1324,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1320,
"end": 1324,
"ctxt": 0
},
"value": "Bear",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 1327,
"end": 1345,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 1327,
"end": 1344,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 1327,
"end": 1338,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1327,
"end": 1333,
"ctxt": 0
},
"value": "pigify",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1334,
"end": 1337,
"ctxt": 0
},
"value": "mbp",
"optional": false
}
}
],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 1339,
"end": 1344,
"ctxt": 0
},
"value": "oinks",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 1375,
"end": 1393,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 1375,
"end": 1392,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 1375,
"end": 1386,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1375,
"end": 1381,
"ctxt": 0
},
"value": "pigify",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1382,
"end": 1385,
"ctxt": 0
},
"value": "mbp",
"optional": false
}
}
],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 1387,
"end": 1392,
"ctxt": 0
},
"value": "walks",
"optional": false
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1447,
"end": 1481,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1457,
"end": 1462,
"ctxt": 0
},
"value": "ITest",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1463,
"end": 1481,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 1467,
"end": 1479,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 1467,
"end": 1471,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1471,
"end": 1479,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 1473,
"end": 1479,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 1473,
"end": 1479,
"ctxt": 0
},
"value": "test",
"raw": "'test'"
}
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 1483,
"end": 1577,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1489,
"end": 1577,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1489,
"end": 1504,
"ctxt": 0
},
"value": "createTestAsync",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1507,
"end": 1577,
"ctxt": 0
},
"params": [],
"body": {
"type": "CallExpression",
"span": {
"start": 1529,
"end": 1577,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 1529,
"end": 1551,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 1529,
"end": 1546,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 1529,
"end": 1544,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1529,
"end": 1536,
"ctxt": 0
},
"value": "Promise",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1537,
"end": 1544,
"ctxt": 0
},
"value": "resolve",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 1547,
"end": 1551,
"ctxt": 0
},
"value": "then",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1552,
"end": 1576,
"ctxt": 0
},
"params": [],
"body": {
"type": "ParenthesisExpression",
"span": {
"start": 1558,
"end": 1576,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 1559,
"end": 1575,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 1561,
"end": 1565,
"ctxt": 0
},
"value": "name",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 1567,
"end": 1573,
"ctxt": 0
},
"value": "test",
"raw": "'test'"
}
}
]
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1509,
"end": 1525,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1511,
"end": 1525,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1511,
"end": 1518,
"ctxt": 0
},
"value": "Promise",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1518,
"end": 1525,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 1519,
"end": 1524,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1519,
"end": 1524,
"ctxt": 0
},
"value": "ITest",
"optional": false
},
"typeParams": null
}
]
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1579,
"end": 1640,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1585,
"end": 1640,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1585,
"end": 1595,
"ctxt": 0
},
"value": "createTest",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1598,
"end": 1640,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 1611,
"end": 1640,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1615,
"end": 1638,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 1622,
"end": 1638,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 1624,
"end": 1628,
"ctxt": 0
},
"value": "name",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 1630,
"end": 1636,
"ctxt": 0
},
"value": "test",
"raw": "'test'"
}
}
]
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1600,
"end": 1607,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1602,
"end": 1607,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1602,
"end": 1607,
"ctxt": 0
},
"value": "ITest",
"optional": false
},
"typeParams": null
}
}
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1659,
"end": 1661,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 1668,
"end": 1676,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1668,
"end": 1676,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1669,
"end": 1676,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1671,
"end": 1676,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1671,
"end": 1672,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1671,
"end": 1672,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1675,
"end": 1676,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1675,
"end": 1676,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 1642,
"end": 1685,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1661,
"end": 1667,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1662,
"end": 1663,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1662,
"end": 1663,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 1665,
"end": 1666,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1665,
"end": 1666,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1677,
"end": 1684,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1679,
"end": 1684,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1679,
"end": 1680,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1679,
"end": 1680,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1683,
"end": 1684,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1683,
"end": 1684,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1703,
"end": 1705,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 1712,
"end": 1716,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1712,
"end": 1716,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1713,
"end": 1716,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1715,
"end": 1716,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1715,
"end": 1716,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 1718,
"end": 1722,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1718,
"end": 1722,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1719,
"end": 1722,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1721,
"end": 1722,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1721,
"end": 1722,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 1686,
"end": 1731,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1705,
"end": 1711,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1706,
"end": 1707,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1706,
"end": 1707,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 1709,
"end": 1710,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1709,
"end": 1710,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1723,
"end": 1730,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1725,
"end": 1730,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1725,
"end": 1726,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1725,
"end": 1726,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1729,
"end": 1730,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1729,
"end": 1730,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 1733,
"end": 1758,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1737,
"end": 1757,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1737,
"end": 1739,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1739,
"end": 1747,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1741,
"end": 1747,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 1750,
"end": 1757,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1750,
"end": 1752,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1753,
"end": 1756,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1759,
"end": 1789,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1763,
"end": 1788,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1763,
"end": 1765,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1765,
"end": 1773,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1767,
"end": 1773,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 1776,
"end": 1788,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1776,
"end": 1778,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1779,
"end": 1782,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1784,
"end": 1787,
"ctxt": 0
},
"value": "b",
"raw": "'b'"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1813,
"end": 1838,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1819,
"end": 1837,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1819,
"end": 1823,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1826,
"end": 1837,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 1835,
"end": 1837,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1826,
"end": 1829,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1827,
"end": 1828,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1827,
"end": 1828,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1839,
"end": 1896,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1845,
"end": 1895,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1845,
"end": 1851,
"ctxt": 0
},
"value": "assign",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1854,
"end": 1895,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 1861,
"end": 1865,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1862,
"end": 1865,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1864,
"end": 1865,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1864,
"end": 1865,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "Identifier",
"span": {
"start": 1867,
"end": 1871,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1868,
"end": 1871,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1870,
"end": 1871,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1870,
"end": 1871,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
],
"body": {
"type": "CallExpression",
"span": {
"start": 1876,
"end": 1895,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 1876,
"end": 1889,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1876,
"end": 1882,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1883,
"end": 1889,
"ctxt": 0
},
"value": "assign",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1890,
"end": 1891,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1893,
"end": 1894,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
],
"typeArguments": null
},
"async": false,
"generator": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1854,
"end": 1860,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1855,
"end": 1856,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1855,
"end": 1856,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 1858,
"end": 1859,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1858,
"end": 1859,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1897,
"end": 1966,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1903,
"end": 1965,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1903,
"end": 1906,
"ctxt": 0
},
"value": "res",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1906,
"end": 1936,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 1908,
"end": 1936,
"ctxt": 0
},
"types": [
{
"type": "TsParenthesizedType",
"span": {
"start": 1908,
"end": 1920,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 1909,
"end": 1919,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1912,
"end": 1919,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1915,
"end": 1919,
"ctxt": 0
},
"kind": "void"
}
}
}
},
{
"type": "TsTypeLiteral",
"span": {
"start": 1923,
"end": 1936,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 1925,
"end": 1934,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 1925,
"end": 1929,
"ctxt": 0
},
"value": "func",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1929,
"end": 1934,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1931,
"end": 1934,
"ctxt": 0
},
"kind": "any"
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 1939,
"end": 1965,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1939,
"end": 1945,
"ctxt": 0
},
"value": "assign",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1946,
"end": 1954,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 1952,
"end": 1954,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 1956,
"end": 1964,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 1958,
"end": 1962,
"ctxt": 0
},
"value": "func",
"optional": false
}
]
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}