Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect type for Set.prototype.values().next Iterator #53223

Closed
vezaynk opened this issue Mar 12, 2023 · 1 comment
Closed

Incorrect type for Set.prototype.values().next Iterator #53223

vezaynk opened this issue Mar 12, 2023 · 1 comment

Comments

@vezaynk
Copy link

vezaynk commented Mar 12, 2023

Bug Report

Default iterator TReturn type is any. This causes code which works with iterators without a defined TReturn type to return any when getting next().value.

const set1 = new Set<string>();

// Should be `string | undefined` but is `any`
const e1 = set1.values().next().value;
//    ^?

Playground

🔎 Search Terms

iterator, set, treturn, next any

🕗 Version & Regression Information

⏯ Playground Link

Playground link with relevant code

💻 Code

const set1 = new Set<string>();

// Should be `string | undefined` but is `any`
const e1 = set1.values().next().value;
//    ^?

🙁 Actual behavior

e1 should be string | undefined

🙂 Expected behavior

e1 is any

@whzx5byb
Copy link

Duplicate of #33353

@vezaynk vezaynk closed this as completed Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants