Support TS 4.3 get/set type members (#13089)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
committed by
Nicolò Ribaudo
parent
2521c666f7
commit
7484b51e56
@@ -43,7 +43,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":34,"end":38,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -74,7 +75,8 @@
|
||||
"type": "TSAnyKeyword",
|
||||
"start":56,"end":59,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -126,7 +128,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":95,"end":99,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":38}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
6
packages/babel-parser/test/fixtures/typescript/interface/get-set-ambiguous/input.ts
vendored
Normal file
6
packages/babel-parser/test/fixtures/typescript/interface/get-set-ambiguous/input.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
interface Foo {
|
||||
get
|
||||
foo(): string;
|
||||
set
|
||||
bar(v);
|
||||
}
|
||||
86
packages/babel-parser/test/fixtures/typescript/interface/get-set-ambiguous/output.json
vendored
Normal file
86
packages/babel-parser/test/fixtures/typescript/interface/get-set-ambiguous/output.json
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":56,"loc":{"start":{"line":1,"column":14},"end":{"line":6,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSPropertySignature",
|
||||
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"get"},
|
||||
"name": "get"
|
||||
},
|
||||
"computed": false
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":24,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":24,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":29,"end":37,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":15}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":31,"end":37,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15}}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSPropertySignature",
|
||||
"start":41,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":41,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"set"},
|
||||
"name": "set"
|
||||
},
|
||||
"computed": false
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":47,"end":54,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":9}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":47,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":51,"end":52,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"v"},
|
||||
"name": "v"
|
||||
}
|
||||
],
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
interface Foo {
|
||||
set bar(foo?: string);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: A 'set' accessor cannot have an optional parameter. (3:1)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":42,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":40,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "set",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":26,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":22},"identifierName":"foo"},
|
||||
"name": "foo",
|
||||
"optional": true,
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":30,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":32,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-invalid-parameters/input.ts
vendored
Normal file
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-invalid-parameters/input.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
interface Foo {
|
||||
get foo(param): string;
|
||||
set foo();
|
||||
}
|
||||
70
packages/babel-parser/test/fixtures/typescript/interface/get-set-invalid-parameters/output.json
vendored
Normal file
70
packages/babel-parser/test/fixtures/typescript/interface/get-set-invalid-parameters/output.json
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: A 'get' accesor must not have any formal parameters. (3:5)",
|
||||
"SyntaxError: A 'set' accesor must have exactly one formal parameter. (4:1)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":56,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "get",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":26,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"param"},
|
||||
"name": "param"
|
||||
}
|
||||
],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":32,"end":40,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":34,"end":40,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":24}}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":44,"end":54,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":12}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":48,"end":51,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "set",
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
interface Foo {
|
||||
set bar(...v);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: A 'set' accessor cannot have rest parameter. (3:1)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "set",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":26,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":29,"end":30,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"v"},
|
||||
"name": "v"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
interface Foo {
|
||||
set foo(param): string;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: A 'set' accessor cannot have a return type annotation. (2:16)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":43,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}},
|
||||
"kind": "set",
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":26,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"param"},
|
||||
"name": "param"
|
||||
}
|
||||
],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":32,"end":40,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":34,"end":40,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":24}}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
interface Foo {
|
||||
get bar(this: Foo);
|
||||
set bar(this: Foo);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: A 'get' accesor must not have any formal parameters. (3:5)",
|
||||
"SyntaxError: 'get' and 'set' accessors cannot declare 'this' parameters. (3:5)",
|
||||
"SyntaxError: 'get' and 'set' accessors cannot declare 'this' parameters. (4:1)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":61,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "get",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":26,"end":35,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19},"identifierName":"this"},
|
||||
"name": "this",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":30,"end":35,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeReference",
|
||||
"start":32,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19}},
|
||||
"typeName": {
|
||||
"type": "Identifier",
|
||||
"start":32,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":40,"end":59,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":44,"end":47,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "set",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":48,"end":57,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":19},"identifierName":"this"},
|
||||
"name": "this",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":52,"end":57,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":19}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeReference",
|
||||
"start":54,"end":57,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19}},
|
||||
"typeName": {
|
||||
"type": "Identifier",
|
||||
"start":54,"end":57,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-methods/input.ts
vendored
Normal file
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-methods/input.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
interface Foo {
|
||||
get(): string;
|
||||
set(): string;
|
||||
}
|
||||
68
packages/babel-parser/test/fixtures/typescript/interface/get-set-methods/output.json
vendored
Normal file
68
packages/babel-parser/test/fixtures/typescript/interface/get-set-methods/output.json
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":51,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"get"},
|
||||
"name": "get"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":23,"end":31,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":15}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":25,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":35,"end":49,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":35,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"set"},
|
||||
"name": "set"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":40,"end":48,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":15}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":42,"end":48,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15}}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-properties/input.ts
vendored
Normal file
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-properties/input.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
interface Foo {
|
||||
get foo: string;
|
||||
set bar: string;
|
||||
}
|
||||
66
packages/babel-parser/test/fixtures/typescript/interface/get-set-properties/output.json
vendored
Normal file
66
packages/babel-parser/test/fixtures/typescript/interface/get-set-properties/output.json
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":55,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSPropertySignature",
|
||||
"start":18,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "get",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":25,"end":33,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":17}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":27,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSPropertySignature",
|
||||
"start":37,"end":53,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":18}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":41,"end":44,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "set",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":44,"end":52,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":17}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":46,"end":52,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17}}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-type-parameters/input.ts
vendored
Normal file
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-type-parameters/input.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
interface Foo {
|
||||
get foo<T>(): string;
|
||||
set bar<T>(v);
|
||||
}
|
||||
92
packages/babel-parser/test/fixtures/typescript/interface/get-set-type-parameters/output.json
vendored
Normal file
92
packages/babel-parser/test/fixtures/typescript/interface/get-set-type-parameters/output.json
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: An accessor cannot have type parameters. (2:10)",
|
||||
"SyntaxError: An accessor cannot have type parameters. (3:10)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":58,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "get",
|
||||
"typeParameters": {
|
||||
"type": "TSTypeParameterDeclaration",
|
||||
"start":25,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}},
|
||||
"params": [
|
||||
{
|
||||
"type": "TSTypeParameter",
|
||||
"start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}},
|
||||
"name": "T"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":30,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":32,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":42,"end":56,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":46,"end":49,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "set",
|
||||
"typeParameters": {
|
||||
"type": "TSTypeParameterDeclaration",
|
||||
"start":49,"end":52,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":12}},
|
||||
"params": [
|
||||
{
|
||||
"type": "TSTypeParameter",
|
||||
"start":50,"end":51,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}},
|
||||
"name": "T"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":53,"end":54,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14},"identifierName":"v"},
|
||||
"name": "v"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
4
packages/babel-parser/test/fixtures/typescript/interface/get-set/input.ts
vendored
Normal file
4
packages/babel-parser/test/fixtures/typescript/interface/get-set/input.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
interface Foo {
|
||||
get foo(): string;
|
||||
set bar(v);
|
||||
}
|
||||
66
packages/babel-parser/test/fixtures/typescript/interface/get-set/output.json
vendored
Normal file
66
packages/babel-parser/test/fixtures/typescript/interface/get-set/output.json
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSInterfaceDeclaration",
|
||||
"start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
|
||||
"name": "Foo"
|
||||
},
|
||||
"body": {
|
||||
"type": "TSInterfaceBody",
|
||||
"start":14,"end":52,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":18,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}},
|
||||
"kind": "get",
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":27,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":29,"end":35,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":39,"end":50,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}},
|
||||
"kind": "set",
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":43,"end":46,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":47,"end":48,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"v"},
|
||||
"name": "v"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,8 @@
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -50,7 +51,8 @@
|
||||
"name": "b"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -62,7 +64,8 @@
|
||||
"name": "c"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -74,7 +77,8 @@
|
||||
"name": "d"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -86,7 +90,8 @@
|
||||
"name": "e"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -98,7 +103,8 @@
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -110,7 +116,8 @@
|
||||
"name": "g"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
"start":19,"end":25,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11},"identifierName":"Symbol"},
|
||||
"name": "Symbol"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":26,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":20},"identifierName":"iterator"},
|
||||
"name": "iterator"
|
||||
},
|
||||
"computed": false
|
||||
}
|
||||
},
|
||||
"parameters": [],
|
||||
"typeAnnotation": {
|
||||
@@ -46,7 +46,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":39,"end":43,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -60,12 +61,12 @@
|
||||
"start":50,"end":56,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"},
|
||||
"name": "Symbol"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":57,"end":65,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"},
|
||||
"name": "iterator"
|
||||
},
|
||||
"computed": false
|
||||
}
|
||||
},
|
||||
"optional": true,
|
||||
"parameters": [],
|
||||
@@ -76,7 +77,8 @@
|
||||
"type": "TSNumberKeyword",
|
||||
"start":71,"end":77,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":32}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":24,"end":28,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
"name": "m"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": []
|
||||
"parameters": [],
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -83,7 +84,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":58,"end":62,"loc":{"start":{"line":3,"column":35},"end":{"line":3,"column":39}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":26,"end":30,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -74,7 +75,8 @@
|
||||
"type": "TSAnyKeyword",
|
||||
"start":48,"end":51,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -126,7 +128,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":87,"end":91,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":38}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":27,"end":31,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":17}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":23,"end":27,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -74,7 +75,8 @@
|
||||
"type": "TSAnyKeyword",
|
||||
"start":45,"end":48,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
@@ -126,7 +128,8 @@
|
||||
"type": "TSVoidKeyword",
|
||||
"start":84,"end":88,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":38}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind": "method"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
4
packages/babel-parser/test/fixtures/typescript/types/type-literal-get-set/input.ts
vendored
Normal file
4
packages/babel-parser/test/fixtures/typescript/types/type-literal-get-set/input.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var obj: {
|
||||
get foo(): string;
|
||||
set bar(v);
|
||||
};
|
||||
78
packages/babel-parser/test/fixtures/typescript/types/type-literal-get-set/output.json
vendored
Normal file
78
packages/babel-parser/test/fixtures/typescript/types/type-literal-get-set/output.json
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":47,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":47,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":1},"identifierName":"obj"},
|
||||
"name": "obj",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":7,"end":47,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeLiteral",
|
||||
"start":9,"end":47,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}},
|
||||
"members": [
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":13,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}},
|
||||
"kind": "get",
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":17,"end":20,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [],
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start":22,"end":30,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19}},
|
||||
"typeAnnotation": {
|
||||
"type": "TSStringKeyword",
|
||||
"start":24,"end":30,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSMethodSignature",
|
||||
"start":34,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}},
|
||||
"kind": "set",
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":38,"end":41,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
},
|
||||
"computed": false,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":42,"end":43,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"v"},
|
||||
"name": "v"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user