TypeScript/tests/cases/compiler/capturedLetConstInLoop13.ts

22 lines
388 B
TypeScript
Raw Normal View History

2017-02-08 03:23:22 +01:00
class Main {
constructor() {
this.register("a", "b", "c");
}
private register(...names: string[]): void {
for (let name of names) {
this.bar({
[name + ".a"]: () => { this.foo(name); },
});
}
}
private bar(a: any): void { }
private foo(name: string): void { }
}
new Main();