Poor type inference for reduce
#25454
Labels
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Needs Proposal
This issue needs a plan that clarifies the finer details of how it could be implemented.
Suggestion
An idea for TypeScript
TypeScript Version: 3.0.0-dev.20180705
Code
Expected behavior:
No error.
Actual behavior:
No error if
arr
isReadonlyArray<number>
or some other non-object
type.No error if I explicitly specify
arr.reduce<string[]>
.No error if I remove the first two overloads to
reduce
, which are non-generic.The text was updated successfully, but these errors were encountered: