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

1553 lines
42 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 769,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 20,
"end": 66,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 25,
"end": 30,
"ctxt": 0
},
"value": "Types",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 33,
"end": 65,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 33,
"end": 42,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 33,
"end": 42,
"ctxt": 0
},
"value": "boolean",
"raw": "'boolean'"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 45,
"end": 54,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 45,
"end": 54,
"ctxt": 0
},
"value": "unknown",
"raw": "'unknown'"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 57,
"end": 65,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 57,
"end": 65,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 68,
"end": 236,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 83,
"ctxt": 0
},
"value": "Properties",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 83,
"end": 119,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 84,
"end": 118,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 94,
"end": 118,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 97,
"end": 108,
"ctxt": 0
},
"value": "key",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 100,
"end": 108,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 102,
"end": 108,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 109,
"end": 116,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 111,
"end": 116,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 111,
"end": 116,
"ctxt": 0
},
"value": "Types",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 96,
"end": 116,
"ctxt": 0
}
}
]
},
"default": null
}
]
},
"typeAnnotation": {
"type": "TsMappedType",
"span": {
"start": 122,
"end": 236,
"ctxt": 0
},
"readonly": true,
"typeParam": {
"type": "TsTypeParameter",
"span": {
"start": 138,
"end": 152,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 138,
"end": 141,
"ctxt": 0
},
"value": "key",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeOperator",
"span": {
"start": 145,
"end": 152,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"default": null
},
"nameType": null,
"optional": null,
"typeAnnotation": {
"type": "TsConditionalType",
"span": {
"start": 155,
"end": 234,
"ctxt": 0
},
"checkType": {
"type": "TsIndexedAccessType",
"span": {
"start": 155,
"end": 161,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsTypeReference",
"span": {
"start": 157,
"end": 160,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 157,
"end": 160,
"ctxt": 0
},
"value": "key",
"optional": false
},
"typeParams": null
}
},
"extendsType": {
"type": "TsLiteralType",
"span": {
"start": 170,
"end": 179,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 170,
"end": 179,
"ctxt": 0
},
"value": "boolean",
"raw": "'boolean'"
}
},
"trueType": {
"type": "TsKeywordType",
"span": {
"start": 182,
"end": 189,
"ctxt": 0
},
"kind": "boolean"
},
"falseType": {
"type": "TsConditionalType",
"span": {
"start": 192,
"end": 234,
"ctxt": 0
},
"checkType": {
"type": "TsIndexedAccessType",
"span": {
"start": 192,
"end": 198,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsTypeReference",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"value": "key",
"optional": false
},
"typeParams": null
}
},
"extendsType": {
"type": "TsLiteralType",
"span": {
"start": 207,
"end": 215,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 207,
"end": 215,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"trueType": {
"type": "TsKeywordType",
"span": {
"start": 218,
"end": 224,
"ctxt": 0
},
"kind": "string"
},
"falseType": {
"type": "TsKeywordType",
"span": {
"start": 227,
"end": 234,
"ctxt": 0
},
"kind": "unknown"
}
}
}
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 238,
"end": 293,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 243,
"end": 250,
"ctxt": 0
},
"value": "AnyCtor",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 250,
"end": 268,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 251,
"end": 267,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "P",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsKeywordType",
"span": {
"start": 261,
"end": 267,
"ctxt": 0
},
"kind": "object"
},
"default": null
}
]
},
"typeAnnotation": {
"type": "TsConstructorType",
"span": {
"start": 271,
"end": 293,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 276,
"end": 287,
"ctxt": 0
},
"rest": {
"start": 276,
"end": 279,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 279,
"end": 280,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 280,
"end": 287,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 282,
"end": 287,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 282,
"end": 285,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 289,
"end": 293,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 292,
"end": 293,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 292,
"end": 293,
"ctxt": 0
},
"value": "P",
"optional": false
},
"typeParams": null
}
},
"isAbstract": false
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 312,
"end": 331,
"ctxt": 0
},
"value": "classWithProperties",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 386,
"end": 399,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 386,
"end": 399,
"ctxt": 0
},
"value": "properties",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 396,
"end": 399,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 398,
"end": 399,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 398,
"end": 399,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 401,
"end": 418,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 401,
"end": 418,
"ctxt": 0
},
"value": "klass",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 406,
"end": 418,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 408,
"end": 418,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 408,
"end": 415,
"ctxt": 0
},
"value": "AnyCtor",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 415,
"end": 418,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 416,
"end": 417,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 416,
"end": 417,
"ctxt": 0
},
"value": "P",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 295,
"end": 488,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 331,
"end": 385,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 332,
"end": 366,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 332,
"end": 333,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 342,
"end": 366,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 345,
"end": 356,
"ctxt": 0
},
"value": "key",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 348,
"end": 356,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 350,
"end": 356,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 357,
"end": 364,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 359,
"end": 364,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 359,
"end": 364,
"ctxt": 0
},
"value": "Types",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 344,
"end": 364,
"ctxt": 0
}
}
]
},
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 368,
"end": 384,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 368,
"end": 369,
"ctxt": 0
},
"value": "P",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsKeywordType",
"span": {
"start": 378,
"end": 384,
"ctxt": 0
},
"kind": "object"
},
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 419,
"end": 487,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 421,
"end": 487,
"ctxt": 0
},
"members": [
{
"type": "TsConstructSignatureDeclaration",
"span": {
"start": 427,
"end": 452,
"ctxt": 0
},
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 432,
"end": 451,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 434,
"end": 451,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 434,
"end": 435,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 434,
"end": 435,
"ctxt": 0
},
"value": "P",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 438,
"end": 451,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 438,
"end": 448,
"ctxt": 0
},
"value": "Properties",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 448,
"end": 451,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 449,
"end": 450,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 449,
"end": 450,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
}
]
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 457,
"end": 485,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 457,
"end": 466,
"ctxt": 0
},
"value": "prototype",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 466,
"end": 485,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 468,
"end": 485,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"value": "P",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 472,
"end": 485,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 472,
"end": 482,
"ctxt": 0
},
"value": "Properties",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 482,
"end": 485,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 483,
"end": 484,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 483,
"end": 484,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
}
]
}
},
"typeParams": null
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 490,
"end": 604,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 496,
"end": 603,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 496,
"end": 500,
"ctxt": 0
},
"value": "Base",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 503,
"end": 603,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 503,
"end": 522,
"ctxt": 0
},
"value": "classWithProperties",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 523,
"end": 586,
"ctxt": 0
},
"properties": [
{
"type": "GetterProperty",
"span": {
"start": 529,
"end": 566,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 533,
"end": 534,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 537,
"end": 566,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 539,
"end": 564,
"ctxt": 0
},
"argument": {
"type": "TsConstAssertion",
"span": {
"start": 546,
"end": 564,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 546,
"end": 555,
"ctxt": 0
},
"value": "boolean",
"raw": "'boolean'"
}
}
}
]
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 572,
"end": 573,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 575,
"end": 583,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
}
]
}
},
{
"spread": null,
"expression": {
"type": "ClassExpression",
"identifier": {
"type": "Identifier",
"span": {
"start": 594,
"end": 598,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"span": {
"start": 588,
"end": 602,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 612,
"end": 619,
"ctxt": 0
},
"value": "MyClass",
"optional": false
},
"declare": false,
"span": {
"start": 606,
"end": 718,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 639,
"end": 676,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 643,
"end": 644,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 639,
"end": 676,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 647,
"end": 676,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 657,
"end": 670,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 664,
"end": 669,
"ctxt": 0
},
"value": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 681,
"end": 716,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 685,
"end": 686,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 681,
"end": 716,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 689,
"end": 716,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 699,
"end": 710,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 706,
"end": 710,
"ctxt": 0
},
"value": "hi",
"raw": "'hi'"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 628,
"end": 632,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 720,
"end": 747,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 726,
"end": 746,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 726,
"end": 730,
"ctxt": 0
},
"value": "mine",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 733,
"end": 746,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 737,
"end": 744,
"ctxt": 0
},
"value": "MyClass",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 748,
"end": 769,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 754,
"end": 768,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 754,
"end": 759,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 762,
"end": 768,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 762,
"end": 766,
"ctxt": 0
},
"value": "mine",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 767,
"end": 768,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"definite": false
}
]
}
],
"interpreter": null
}