Issue
The following code fails to compile with error Expected "?" but found end of file:
type InferUnion<T> = T extends { a: infer U extends number } | infer U extends number
? U
: never
The issue seems to be with infer U extends at the top level of a union, as the following compiles fine:
type InferUnion<T> = T extends { a: infer U extends number } | { b: infer U extends number }
? U
: never
Reproduction
esbuild playground
Issue
The following code fails to compile with error
Expected "?" but found end of file:The issue seems to be with
infer U extendsat the top level of a union, as the following compiles fine:Reproduction
esbuild playground