#64231·TypeScript

Parser misinterprets async() calls in conditional expressions as async arrow functions

Author: camc314Created Sep 10, 2026Updated Sep 16, 2026
LabelsBug

Search Terms

parser, async, conditional

Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

No response

Code

const a = true;
const b = 1;

function async(): number {
  return b;
}

const first = a ? async() : 0;
//                       TS1005: '=>' expected.

const second = a ? async() : x => x;
//                                TS1005: ':' expected.

Actual behavior

The parser appears to interpret async() as the beginning of an async arrow function and the conditional separator as a return-type annotation. The first case also produces a syntax diagnostic when parsed as JavaScript after removing the : number annotation. Node accepts and executes that JavaScript equivalent

Expected behavior

Both conditional expressions should parse successfully. async() is a call to the function named async, and the following colon separates the conditional’s branches.

Additional information about the issue

Oxc fix: https://github.com/oxc-project/oxc/pull/26537