We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Happens in both versions 4.2.3 and 4.3.0-beta
Playground link with relevant code
const s = new Set<string>(); s.values().next().value;
Type of value is any.
value
any
Type of value should probably be string | undefined or something.
string | undefined
The text was updated successfully, but these errors were encountered:
next() returns a discriminated union so you can get what you want:
next()
const v = s.values().next(); if (v.done) { v.value; // any } else { v.value; // string }
It would make more sense for v.value to be typed as void or undefined in the done case though.
v.value
void
undefined
Sorry, something went wrong.
@nmain Or never.
never
@rbuckton I believe we have a duplicate of this?
Ahh yes, this seems to be #33353 Search terms: iteratorresult return
rbuckton
Successfully merging a pull request may close this issue.
Bug Report
π Search Terms
π Version & Regression Information
Happens in both versions 4.2.3 and 4.3.0-beta
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Type of
value
isany
.π Expected behavior
Type of
value
should probably bestring | undefined
or something.The text was updated successfully, but these errors were encountered: