Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Generators compiled with --target es5 --lib esnext do not support iterator helpersΒ #59513

Copy link
Copy link
@rbuckton

Description

@rbuckton
Issue body actions

πŸ”Ž Search Terms

generator iterator helper map esnext prototype

πŸ•— Version & Regression Information

⏯ Playground Link

https://www.typescriptlang.org/play/?target=1&lib=lib.esnext.d.ts&ts=5.6.0-beta#code/PTAEAEBcEMCcHMCmkBcpEGcCsAoEEAbASwCM1MA7RAD0hxwGMB7CjSUOUAXlAG0BGADSgATMIDMwgCwBdANw44AOgBu0AgFdMACgCUSgLbQADtqLcAfKHMAqUbrmh8vMaCnCAbMIAcM+gDMNCgZIIhZQO389UABvHFBQAE8iRAIAEwi+IVEJaXkcAF8cKP0jU3MuK1t7R3xYINCDRHRYWCZYNAByKKVe0pNO6wxQCiZ2aFBA4NCWIA

πŸ’» 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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.