Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
laszlopandy opened this issue Jul 4, 2017 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@laszlopandy
Copy link

laszlopandy commented Jul 4, 2017

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)
@ikatyang
Copy link
Contributor

ikatyang commented Jul 4, 2017

Something wrong between v2.3.4 and v2.4.0

image

@jwbay
Copy link
Contributor

jwbay commented Jul 4, 2017

Ref: #16120

@rbuckton rbuckton self-assigned this Aug 5, 2017
@rbuckton rbuckton added the Bug A bug in TypeScript label Aug 5, 2017
@rbuckton rbuckton added this to the TypeScript 2.5 milestone Aug 5, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.5.1, TypeScript 2.5 Aug 16, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Aug 25, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

5 participants