Correctly handle generic functions (e.g.: Object.freeze) passed as callbacks to generic functions (e.g.: Array.prototype.map)
#42862
Labels
Has Repro
This issue has compiler-backed repros: https://aka.ms/ts-repros
In Discussion
Not yet reached consensus
Suggestion
An idea for TypeScript
Suggestion
My suggestion meets these guidelines:
A generic transforming function (e.g.:
Object.freeze) passed as a callback to a generic mapping function (such asArray.prototype.map), should be handled similarly to an arrow function with inferred types.From engine262/src/engine.mjs:
Workbench Repro
Expected type:
Like when using an arrow function:
Workbench Repro
Actual type:
Getting correct type inference for JavaScript code on the wild web.
Related issues
readonlytype operator to allow correct definition ofObject.freeze#10725The text was updated successfully, but these errors were encountered: