TypeScript/tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts
Anders Hejlsberg 25738a8e41 Update tests
2017-02-28 16:09:42 -08:00

37 lines
705 B
TypeScript

// @noImplicitAny: true
// @noImplicitThis: true
let o = {
d: "bar",
m() {
return this.d.length;
},
f: function() {
return this.d.length;
}
}
let mutuallyRecursive = {
a: 100,
start() {
return this.passthrough(this.a);
},
passthrough(n: number) {
return this.sub1(n);
},
sub1(n: number): number {
if (n > 0) {
return this.passthrough(n - 1);
}
return n;
}
}
var i: number = mutuallyRecursive.start();
interface I {
a: number;
start(): number;
passthrough(n: number): number;
sub1(n: number): number;
}
var impl: I = mutuallyRecursive;