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

2725 lines
72 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 19,
"end": 1290,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 28,
"end": 30,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 86,
"end": 93,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 88,
"end": 93,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 19,
"end": 189,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 95,
"end": 189,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 160,
"end": 187,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 164,
"end": 186,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 165,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 167,
"end": 182,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 167,
"end": 173,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 176,
"end": 182,
"ctxt": 0
},
"kind": "number"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 30,
"end": 84,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 31,
"end": 56,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 41,
"end": 56,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 41,
"end": 47,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 50,
"end": 56,
"ctxt": 0
},
"kind": "number"
}
]
},
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 58,
"end": 83,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 68,
"end": 83,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"kind": "number"
}
]
},
"default": null
}
]
},
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 200,
"end": 202,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 279,
"end": 287,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 279,
"end": 287,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 280,
"end": 287,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 282,
"end": 287,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 191,
"end": 558,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 289,
"end": 558,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 295,
"end": 323,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 299,
"end": 322,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 299,
"end": 301,
"ctxt": 0
},
"value": "y1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 301,
"end": 318,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 303,
"end": 318,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 303,
"end": 309,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 312,
"end": 318,
"ctxt": 0
},
"kind": "number"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 341,
"end": 367,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 345,
"end": 366,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 345,
"end": 347,
"ctxt": 0
},
"value": "y2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 347,
"end": 362,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 349,
"end": 362,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 349,
"end": 355,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 358,
"end": 362,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 365,
"end": 366,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 387,
"end": 418,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 391,
"end": 417,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 391,
"end": 393,
"ctxt": 0
},
"value": "y3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 393,
"end": 413,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 395,
"end": 413,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 395,
"end": 401,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 404,
"end": 413,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 416,
"end": 417,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 423,
"end": 449,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 427,
"end": 448,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 427,
"end": 429,
"ctxt": 0
},
"value": "y4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 429,
"end": 444,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 431,
"end": 444,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 431,
"end": 437,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 440,
"end": 444,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 447,
"end": 448,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 469,
"end": 500,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 473,
"end": 499,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 473,
"end": 475,
"ctxt": 0
},
"value": "y5",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 475,
"end": 495,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 477,
"end": 495,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 477,
"end": 483,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 486,
"end": 495,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 515,
"end": 544,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 519,
"end": 543,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 519,
"end": 521,
"ctxt": 0
},
"value": "y6",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 521,
"end": 539,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 523,
"end": 539,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 523,
"end": 527,
"ctxt": 0
},
"kind": "null"
},
{
"type": "TsKeywordType",
"span": {
"start": 530,
"end": 539,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 542,
"end": 543,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 202,
"end": 278,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 203,
"end": 240,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 203,
"end": 204,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 213,
"end": 240,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 222,
"end": 228,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 231,
"end": 240,
"ctxt": 0
},
"kind": "undefined"
}
]
},
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 242,
"end": 277,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 252,
"end": 277,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 252,
"end": 258,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 261,
"end": 265,
"ctxt": 0
},
"kind": "null"
},
{
"type": "TsKeywordType",
"span": {
"start": 268,
"end": 277,
"ctxt": 0
},
"kind": "undefined"
}
]
},
"default": null
}
]
},
"returnType": null
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 560,
"end": 630,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 565,
"end": 567,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 570,
"end": 629,
"ctxt": 0
},
"types": [
{
"type": "TsParenthesizedType",
"span": {
"start": 570,
"end": 599,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 571,
"end": 598,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 571,
"end": 577,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 580,
"end": 586,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 589,
"end": 598,
"ctxt": 0
},
"kind": "undefined"
}
]
}
},
{
"type": "TsParenthesizedType",
"span": {
"start": 602,
"end": 629,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 603,
"end": 628,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 603,
"end": 609,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 612,
"end": 616,
"ctxt": 0
},
"kind": "null"
},
{
"type": "TsKeywordType",
"span": {
"start": 619,
"end": 628,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 664,
"end": 666,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 706,
"end": 742,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 706,
"end": 742,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 707,
"end": 742,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 709,
"end": 742,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 709,
"end": 710,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 709,
"end": 710,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsParenthesizedType",
"span": {
"start": 713,
"end": 742,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 714,
"end": 741,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 714,
"end": 720,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 723,
"end": 729,
"ctxt": 0
},
"kind": "object"
},
{
"type": "TsKeywordType",
"span": {
"start": 732,
"end": 741,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 655,
"end": 784,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 744,
"end": 784,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 750,
"end": 782,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 756,
"end": 781,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 756,
"end": 757,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 757,
"end": 777,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 759,
"end": 777,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 759,
"end": 765,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 768,
"end": 777,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 780,
"end": 781,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 666,
"end": 705,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 667,
"end": 704,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 667,
"end": 668,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 677,
"end": 704,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 677,
"end": 683,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 686,
"end": 692,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 695,
"end": 704,
"ctxt": 0
},
"kind": "undefined"
}
]
},
"default": null
}
]
},
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 795,
"end": 797,
"ctxt": 0
},
"value": "f4",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 825,
"end": 849,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 825,
"end": 849,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 826,
"end": 849,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 828,
"end": 849,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 828,
"end": 829,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 828,
"end": 829,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsParenthesizedType",
"span": {
"start": 832,
"end": 849,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 833,
"end": 848,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 833,
"end": 839,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 842,
"end": 848,
"ctxt": 0
},
"kind": "object"
}
]
}
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 786,
"end": 879,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 851,
"end": 879,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 857,
"end": 877,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 863,
"end": 876,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 863,
"end": 864,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 864,
"end": 872,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 866,
"end": 872,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 875,
"end": 876,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 797,
"end": 824,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 798,
"end": 823,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 798,
"end": 799,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 808,
"end": 823,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 808,
"end": 814,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 817,
"end": 823,
"ctxt": 0
},
"kind": "number"
}
]
},
"default": null
}
]
},
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 890,
"end": 892,
"ctxt": 0
},
"value": "f5",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 915,
"end": 929,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 915,
"end": 929,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 916,
"end": 929,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 918,
"end": 929,
"ctxt": 0
},
"types": [
{
"type": "TsTypeOperator",
"span": {
"start": 918,
"end": 925,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 924,
"end": 925,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 924,
"end": 925,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
{
"type": "TsTypeReference",
"span": {
"start": 928,
"end": 929,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 928,
"end": 929,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 881,
"end": 960,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 931,
"end": 960,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 937,
"end": 958,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 941,
"end": 957,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 941,
"end": 942,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 942,
"end": 953,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeOperator",
"span": {
"start": 944,
"end": 953,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 950,
"end": 953,
"ctxt": 0
},
"kind": "any"
}
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 956,
"end": 957,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 892,
"end": 914,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 893,
"end": 894,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 893,
"end": 894,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 896,
"end": 913,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 896,
"end": 897,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeOperator",
"span": {
"start": 906,
"end": 913,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 912,
"end": 913,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 912,
"end": 913,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"default": null
}
]
},
"returnType": null
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 984,
"end": 1080,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 989,
"end": 996,
"ctxt": 0
},
"value": "Example",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 996,
"end": 1002,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 997,
"end": 998,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 997,
"end": 998,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 1000,
"end": 1001,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1000,
"end": 1001,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"typeAnnotation": {
"type": "TsMappedType",
"span": {
"start": 1005,
"end": 1080,
"ctxt": 0
},
"readonly": null,
"typeParam": {
"type": "TsTypeParameter",
"span": {
"start": 1008,
"end": 1020,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1008,
"end": 1009,
"ctxt": 0
},
"value": "K",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeOperator",
"span": {
"start": 1013,
"end": 1020,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1019,
"end": 1020,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1019,
"end": 1020,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"default": null
},
"nameType": null,
"optional": null,
"typeAnnotation": {
"type": "TsConditionalType",
"span": {
"start": 1023,
"end": 1078,
"ctxt": 0
},
"checkType": {
"type": "TsTypeReference",
"span": {
"start": 1023,
"end": 1024,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1023,
"end": 1024,
"ctxt": 0
},
"value": "K",
"optional": false
},
"typeParams": null
},
"extendsType": {
"type": "TsTypeOperator",
"span": {
"start": 1033,
"end": 1040,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1039,
"end": 1040,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1039,
"end": 1040,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
},
"trueType": {
"type": "TsTypeReference",
"span": {
"start": 1043,
"end": 1061,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1043,
"end": 1058,
"ctxt": 0
},
"value": "UnexpectedError",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1058,
"end": 1061,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 1059,
"end": 1060,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1059,
"end": 1060,
"ctxt": 0
},
"value": "K",
"optional": false
},
"typeParams": null
}
]
}
},
"falseType": {
"type": "TsTypeReference",
"span": {
"start": 1064,
"end": 1078,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1064,
"end": 1075,
"ctxt": 0
},
"value": "NoErrorHere",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1075,
"end": 1078,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 1076,
"end": 1077,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1076,
"end": 1077,
"ctxt": 0
},
"value": "K",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 1082,
"end": 1129,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 1087,
"end": 1102,
"ctxt": 0
},
"value": "UnexpectedError",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1102,
"end": 1125,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1103,
"end": 1124,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1103,
"end": 1104,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 1113,
"end": 1124,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1113,
"end": 1124,
"ctxt": 0
},
"value": "PropertyKey",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1128,
"end": 1129,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1128,
"end": 1129,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 1130,
"end": 1173,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 1135,
"end": 1146,
"ctxt": 0
},
"value": "NoErrorHere",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1146,
"end": 1169,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1147,
"end": 1168,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1147,
"end": 1148,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 1157,
"end": 1168,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1157,
"end": 1168,
"ctxt": 0
},
"value": "PropertyKey",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1172,
"end": 1173,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1172,
"end": 1173,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 1197,
"end": 1246,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 1202,
"end": 1203,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1203,
"end": 1206,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1204,
"end": 1205,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1204,
"end": 1205,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"typeAnnotation": {
"type": "TsConditionalType",
"span": {
"start": 1209,
"end": 1245,
"ctxt": 0
},
"checkType": {
"type": "TsTypeReference",
"span": {
"start": 1209,
"end": 1210,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1209,
"end": 1210,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"extendsType": {
"type": "TsTypeReference",
"span": {
"start": 1219,
"end": 1233,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1219,
"end": 1224,
"ctxt": 0
},
"value": "Array",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1224,
"end": 1233,
"ctxt": 0
},
"params": [
{
"type": "TsInferType",
"span": {
"start": 1225,
"end": 1232,
"ctxt": 0
},
"typeParam": {
"type": "TsTypeParameter",
"span": {
"start": 1231,
"end": 1232,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1231,
"end": 1232,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
}
]
}
},
"trueType": {
"type": "TsTypeReference",
"span": {
"start": 1236,
"end": 1237,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1236,
"end": 1237,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
},
"falseType": {
"type": "TsKeywordType",
"span": {
"start": 1240,
"end": 1245,
"ctxt": 0
},
"kind": "never"
}
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 1247,
"end": 1290,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 1252,
"end": 1253,
"ctxt": 0
},
"value": "b",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 1253,
"end": 1256,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 1254,
"end": 1255,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1254,
"end": 1255,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"typeAnnotation": {
"type": "TsMappedType",
"span": {
"start": 1259,
"end": 1289,
"ctxt": 0
},
"readonly": null,
"typeParam": {
"type": "TsTypeParameter",
"span": {
"start": 1262,
"end": 1281,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 1262,
"end": 1263,
"ctxt": 0
},
"value": "K",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsIntersectionType",
"span": {
"start": 1267,
"end": 1281,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1267,
"end": 1271,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1267,
"end": 1268,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1268,
"end": 1271,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 1269,
"end": 1270,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1269,
"end": 1270,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeOperator",
"span": {
"start": 1274,
"end": 1281,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1280,
"end": 1281,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1280,
"end": 1281,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
]
},
"default": null
},
"nameType": null,
"optional": null,
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 1285,
"end": 1287,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 1285,
"end": 1287,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
}
}
],
"interpreter": null
}