Skip to content

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

Closed

Description

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)

Activity

  1. ikatyang commented on Jul 4, 2017

    @ikatyang
    Contributor

    Something wrong between v2.3.4 and v2.4.0

    image

  2. jwbay commented on Jul 4, 2017

    @jwbay
    Contributor

    Ref: #16120

  3. modified the milestones: , TypeScript 2.5 on Aug 16, 2017
  4. locked and limited conversation to collaborators on Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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