flown
flown copied to clipboard
Error when Reduce is used more than one-time
When a function that uses Reduce type is called more than one-time, flow error occurs:
type MergeAll<T> = Reduce<<X, V>(V) => X => { ...$Exact<X>, ...$Exact<V> }, {}, T>
declare function mergeAll<A>(A): MergeAll<A>
const x = mergeAll([{ a: 1 }, { b: 1 }, { c: 1 }, { a: 2 }])
const xx = mergeAll([{ a: 1 }, { b: 1 }, { c: 1 }, { a: 2 }])
// try to comment this line, the error disappears
;(x: { a: 2, b: 1, c: 1 }) // rightly
// or try to comment this line, the error disappears too
;(xx: { a: 2, b: 1, c: 1 }) // error?!