Visitar URL original
`async <T,>() => {}` + new line + `(...)` is transformed to IIFE · Issue #17472 · babel/babel · GitHub
Skip to content

async <T,>() => {} + new line + (...) is transformed to IIFE #17472

Closed

Description

@hi-ogawa

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

reproduction on repl https://babeljs.io/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&corejs=3.42&code_lz=IYZwngdgxgBAPAFQDQD4AUBKGBeFMDeAvgFBoCMGA3EA&shippedProposals=true&evaluate=true&sourceType=module&lineWrap=true&presets=typescript&prettier=true&version=7.28.2

async <T,>() => {}
(1);

Configuration file name

No response

Configuration

see repl

Current and expected behavior

Current behavior: transformed to IIFE and changes semantics

(async () => {})(1);

Expected behavior: it shouldn't change semantics. for example, tsc's output https://www.typescriptlang.org/play/?module=1#code/IYZwngdgxgBAPAFQDQD4AUBKGBeFMDeAvgFBoCMGA3EA

"use strict";
async () => { };
(1);

Environment

(repl)
babel: 7.28.2

Possible solution

No response

Additional context

Originally reported in vitejs/vite-plugin-react#690, which had slightly more complex code:

const funA = async <T,>(arg1: T) => {
  console.log(arg1)
}
(a as A).register(funA);

Activity

  1. babel-bot commented on Aug 9, 2025

    @babel-bot
    Collaborator

    Hey @hi-ogawa! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

    If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

  2. added theissue type on Aug 9, 2025
  3. added
    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue
    on Nov 11, 2025
  4. locked as resolved and limited conversation to collaborators on Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions