add support for getters and setters in generator for declare class statement (#11502)

This commit is contained in:
Bogdan Savluk 2020-04-30 09:47:42 +02:00 committed by GitHub
parent bb180eba9f
commit 96ccf56436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -575,6 +575,10 @@ export function ObjectTypeProperty(node: Object) {
this.word("static");
this.space();
}
if (node.kind === "get" || node.kind === "set") {
this.word(node.kind);
this.space();
}
this._variance(node);
this.print(node.key, node);
if (node.optional) this.token("?");

View File

@ -7,6 +7,7 @@ declare function foo(x: number, y: string): void;
declare class A {}
declare class A<T> extends B<T> { x: number }
declare class A { static foo(): number; static x : string }
declare class A { set fooProp(value: number): void; get fooProp():number }
declare class A { static [ indexer: number]: string }
declare class A { static () : number }
declare class B { (): number }

View File

@ -12,6 +12,10 @@ declare class A {
static foo(): number,
static x: string,
}
declare class A {
set fooProp(value: number): void,
get fooProp(): number,
}
declare class A {
static [indexer: number]: string
}
@ -42,4 +46,4 @@ declare opaque type Foo<T>: Bar<T>;
declare opaque type ID;
declare opaque type num: number;
declare opaque type NumArray;
declare var sym: symbol;
declare var sym: symbol;