Skip to content

Commit

Permalink
add support for getters and setters in generator for declare class st…
Browse files Browse the repository at this point in the history
…atement (#11502)
  • Loading branch information
zxbodya committed Apr 30, 2020
1 parent bb180eb commit 96ccf56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/babel-generator/src/generators/flow.js
Expand Up @@ -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("?");
Expand Down
Expand Up @@ -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 }
Expand Down
Expand Up @@ -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
}
Expand Down Expand Up @@ -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;

0 comments on commit 96ccf56

Please sign in to comment.