• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1describe("unittests:: evaluation:: asyncArrowEvaluation", () => {
2    // https://github.com/Microsoft/TypeScript/issues/24722
3    it("this capture (es5)", async () => {
4        const result = evaluator.evaluateTypeScript(`
5        export class A {
6            b = async (...args: any[]) => {
7                await Promise.resolve();
8                output.push({ ["a"]: () => this }); // computed property name after 'await' triggers case
9            };
10        }
11        export const output: any[] = [];
12        export async function main() {
13            await new A().b();
14        }`);
15        await result.main();
16        assert.instanceOf(result.output[0].a(), result.A);
17    });
18});
19