Skip to content

[Bug]: _this is not defined from asyncToGenerator.js #14749

@wratho

Description

@wratho

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

updateDiscussionTitle = async (): Promise<void> => {
    await this.legacyWorkspaceService.eznoteData.updateDiscussionTitle(this.data.discussion.discussionId, this.newTitle);
    this.data.discussion.title = this.newTitle;
    this.dialogRef.close();
  };
updateDiscussionTitle = (0,node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
    yield _this.legacyWorkspaceService.eznoteData.updateDiscussionTitle(_this.data.discussion.discussionId, _this.newTitle);
    _this.data.discussion.title = _this.newTitle;

    _this.dialogRef.close();
  });

Configuration file name

No response

Configuration

No response

Current and expected behavior

_this is not being created in this instance. If i async before the function name and don't arrow it's fine. If i IIFE the function in a weird way it works.

I recently Updated to Angular 14, and changed the target in the tsconfig to 2022 from 2020. If i revert back to 2020 it works as well. I have been searching all day for an answer and am hoping this is related to y'all at this point since i can trick it with other ways of formatting the function.

Environment

System:
OS: Windows 10 10.0.19043
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
npmPackages: (from build-angular)
"@babel/core": "7.17.10",
"@babel/generator": "7.17.10",
"@babel/plugin-proposal-async-generator-functions": "7.16.8",
"@babel/plugin-transform-async-to-generator": "7.16.8",
"typescript": 4.7.3,
"angular": 14.0.5

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions