Skip to content

Commit 69acca7

Browse files
author
Evgeniy Timokhov
committed
Added test case for interface getters
1 parent 9d16ae5 commit 69acca7

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

tests/test-cases/export-interface/input.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export interface Interface {
22
publicMethod(opts: Options, b: number): void;
33
publicProperty: number;
4+
get publicGetter(): string;
45
}
56

67
export interface Options {
@@ -17,10 +18,14 @@ class Class implements Interface {
1718
foo: 321,
1819
};
1920

20-
this.privateMethod(this.publicProperty, opts1.foo);
21+
this.privateMethod(this.publicProperty, this.publicGetter, opts1.foo);
2122
}
2223

23-
private privateMethod(a: string | number, b?: number): void { }
24+
public get publicGetter(): string {
25+
return '123';
26+
}
27+
28+
private privateMethod(a: string | number, c: string, b?: number): void { }
2429
}
2530

2631
export function createClass(): Interface {

tests/test-cases/export-interface/output.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ var Class = /** @class */ (function () {
1010
var opts1 = {
1111
foo: 321,
1212
};
13-
this._private_privateMethod(this.publicProperty, opts1.foo);
13+
this._private_privateMethod(this.publicProperty, this.publicGetter, opts1.foo);
1414
};
15-
Class.prototype._private_privateMethod = function (a, b) { };
15+
Object.defineProperty(Class.prototype, "publicGetter", {
16+
get: function () {
17+
return '123';
18+
},
19+
enumerable: false,
20+
configurable: true
21+
});
22+
Class.prototype._private_privateMethod = function (a, c, b) { };
1623
return Class;
1724
}());
1825
function createClass() {

0 commit comments

Comments
 (0)