Skip to content

ReferenceError: _this is not defined, if an arrow function is a static member of a class. #16924

Closed
@laszlopandy

Description

@laszlopandy

TypeScript Version: 2.4.0 / 2.4.1 / 2.5.0-dev.20170629

Code

/* TsBug.ts */
class Test {
    static member = async (x: string) => { };
}
Test.member("");

Compiled with: tsc TsBug.ts --lib es2015.promise,es5
Run with: node TsBug.js

Expected behavior:
No output.

Actual behavior:

/..<snip>../TsBug.js:39
    Test.member = function (x) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
                                                  ^

ReferenceError: _this is not defined
    at Function.Test.member (/..<snip>../TsBug.js:39:51)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions