-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
π Search Terms
generator iterator helper map esnext prototype
π Version & Regression Information
- This changed in commit or PR add types for iterator helpers proposalΒ #58222
β― Playground Link
π» Code
// @target: es5
// @lib: esnext
const ar = [1, 2, 3, 4];
ar.values().map(i => i * 2); // [2, 4, 6, 8]
function * f() {
yield * [1, 2, 3, 4];
}
f().map(i => i * 2); // error: 'f(...).map' is not a functionπ Actual behavior
The last line above throws even when Iterator.prototype is present, be it from the host or a polyfill.
π Expected behavior
The last line above should not throw when the global Iterator.prototype is present and can be used as a prototype.
Additional information about the issue
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueSuggestionAn idea for TypeScriptAn idea for TypeScript