module.exports = {
presets: [
[
'@babel/preset-typescript',
{ isTSX: true, allExtensions: true, disallowAmbiguousJSXLike: true }
]
],
};
/repl.tsx: Unexpected token, expected "?" (3:30)
1 | export type Equals<A1 extends any, A2 extends any> = (<A>() => A extends A2
2 | ? true
> 3 | : false) extends <A>() => A extends A1 ? true : false
| ^
4 | ? true
5 | : false;
It should parse OK. Both TypeScript and Prettier parse this. Babel was also parsing this correctly a few versions back.
💻
How are you using Babel?
Other (Next.js, Gatsby, vue-cli, ...)
Input code
Configuration file name
No response
Configuration
Current and expected behavior
Current
Expected
It should parse OK. Both TypeScript and Prettier parse this. Babel was also parsing this correctly a few versions back.
Environment
https://babeljs.io/repl#?browsers=ie%2011&build=&builtIns=false&corejs=3.6&spec=false&loose=false&code_lz=KYDwDg9gTgLgBDAnmYcCiBHArgQwDYDOAPAIICMcoMwAdgCYFw42IA0cJATJSNfY80QA-OAF44AClJCJASjEiSPPgw6cAUHDgB-BFCzBNcAFxwAZvgLB5VWqulyFHZXcbkdegyfOXDW3TD6ft4WhMAA3EA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Creact%2Ctypescript&prettier=false&targets=&version=7.18.3&externalPlugins=%40babel%2Fplugin-proposal-object-rest-spread%407.6.2&assumptions=%7B%7D
Possible solution
No response
Additional context
No response