Skip to content

[preset-typescript] Ternaries that call a function named async fail to parse #17547

@Brendonovich

Description

@Brendonovich

💻

  • Would you like to work on a fix?

How are you using Babel?

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

Input code

https://babel.dev/repl#?config_lz=N4IgZglgNgpgdgQwLYxALhAJxgBygOgBcBnEAGhB22JhPQG16R4A3c0QhTAc1tIwAmMMAgCuUEmQAEcAPaEpEGFICMK6XIVKA-klkAjVSvIg9A8TH4ioNCvtHdIAD0vpCmUTAC-AXTJNCAE8cSwBjTAgcQnYQBCgoWQB3ABEYUKguGAAxJSgBfndPCjiExIA5ZEscBFDXNELvHz8QYllRTFqAFWDUDDMLEC8gA&code_lz=C4JwrgpgBA_FCGBnAngOwMYApMEooF4A-KAbwF88AuKUSAbiA&lineWrap=true&version=7.28.4

Configuration file name

No response

Configuration

{
  "filename": "/Users/brendonovich/github.com/brendonovich/macrograph/apps/web/.nitro/vite/services/ssr/entry-server.js",
  "sourceFileName": "/Users/brendonovich/github.com/brendonovich/macrograph/apps/web/.nitro/vite/services/ssr/entry-server.js",
  "presets": [
    [
      "[Function: function (context, options = {}) {\n  const plugins ... ]",
      {
        "generate": "ssr",
        "hydratable": true
      }
    ]
  ],
  "plugins": [],
  "ast": false,
  "sourceMaps": true,
  "configFile": false,
  "babelrc": false,
  "parserOpts": {
    "plugins": [
      "jsx",
      "typescript"
    ]
  }
}

Current and expected behavior

This should parse properly as it's valid code

Environment

System:
OS: macOS 14.6.1
Binaries:
Node: 24.6.0 - /Users/brendonovich/.local/state/fnm_multishells/58644_1760265053835/bin/node
npm: 11.5.1 - /Users/brendonovich/.local/state/fnm_multishells/58644_1760265053835/bin/npm
pnpm: 10.12.4 - /opt/homebrew/bin/pnpm
bun: 1.2.21 - /Users/brendonovich/.bun/bin/bun

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions