Summary
A conditional whose branches are arrow functions is read as one arrow function:
export const toPosix = isWin ? (value: string) => value.split(path.sep).join(path.posix.sep) : (value: string) => valueemits export declare const toPosix: (isWin ? (value: string)) => any;, which does not parse. Pinia's getActivePinia and knip's toPosix, debugLog, debugLogObject and debugLogArray are written this way. The same happens for such a conditional in an object property or array element, and for an asserted object holding an arrow ({ render: () => h('div') } as RouteComponent).
Changes
inferNarrowType sent any value with an => outside parentheses to inferFunctionType, which took everything before that arrow as the parameter list. It no longer does when the text before the arrow cannot be an arrow function's parameters: it neither starts with a parameter list (after optional async and type parameters) nor is one name. Such values fall through and are typed unknown, as every other conditional initializer already is (c ? 'a' : 'b'). A conditional whose condition is in parentheses reads as before.
Testing
New test/ternary-arrow-type.test.ts. Seven cases check the output parses and has the expected type; on main all seven fail. Twelve more check that arrow functions read as before, including parentheses inside a string, regular expression or template literal default, a comment after the parameters, and non-ASCII or escaped parameter names.
bun test (Zig library built with the pinned Zig, so its tests run too), typecheck, lint and zig build test pass. Over 4,192 files from vue-core, vue-router, pinia and knip, files whose output does not parse go from 82 to 77; over 11,774 more from tailwindcss, stacks, eslint-plugin-vue and home, from 19 to 16. Every output that changed did not parse before.