René's URL Explorer Experiment


Title: IteratorResult definition conflicts with the JS spec · Issue #38479 · microsoft/TypeScript · GitHub

Open Graph Title: IteratorResult definition conflicts with the JS spec · Issue #38479 · microsoft/TypeScript

X Title: IteratorResult definition conflicts with the JS spec · Issue #38479 · microsoft/TypeScript

Description: TypeScript Version: 3.8.3 Search Terms: iterator return type Code const list = ['v1', 'v2', 'v3'] const f: () => Iterator = () => { let index = 0 return { next: (): IteratorResult => { console.log(list) if (index < list.l...

Open Graph Description: TypeScript Version: 3.8.3 Search Terms: iterator return type Code const list = ['v1', 'v2', 'v3'] const f: () => Iterator = () => { let index = 0 return { next: (): IteratorResult =...

X Description: TypeScript Version: 3.8.3 Search Terms: iterator return type Code const list = ['v1', 'v2', 'v3'] const f: () => Iterator<string> = () => { let index = 0 return ...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/38479

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"IteratorResult\u003cT> definition conflicts with the JS spec","articleBody":"**TypeScript Version:**  3.8.3\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms: iterator return type**\r\n\r\n**Code**\r\n\r\n```ts\r\nconst list = ['v1', 'v2', 'v3']\r\n\r\nconst f: () => Iterator\u003cstring> = () => {\r\n  let index = 0\r\n  return {\r\n    next: (): IteratorResult\u003cstring> => {\r\n      console.log(list)\r\n      if (index \u003c list.length) {\r\n        return { value: list[index++]}\r\n      } else {\r\n        return { done: true }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\nThe code should compile without errors.\r\n**Actual behavior:**\r\nThe code compiles with the error: \"Type '{ done: true; }' is not assignable to type 'IteratorResult\u003cstring, any>'.\r\n  Property 'value' is missing in type '{ done: true; }' but required in type 'IteratorReturnResult\u003cany>'.(2322)\"\r\n\r\nThe error can be bypassed by changing { done: true } to { value: undefined, done: true }. However, the specification allows omitting the value property. See [Iteration Protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols)\r\n\r\nA suggested fix would be to change the definition of the type IteratorReturnResult to:\r\n\r\n```ts\r\ninterface IteratorReturnResult\u003cTReturn> {\r\n    done: true;\r\n    value?: TReturn;\r\n}\r\n```\r\n\r\n**Playground Link:** https://www.typescriptlang.org/play?#code/MYewdgzgLgBANgS2jAvDA2gcgG4EZMA0MOATIcdgMyYC6AUHaJLAGYBcMAFAJSoB8MAJJQApgCcAhlBBiAPNDEIwAcwFoe-GAG86MeCNhKAJiIAeqGAAZdMMQYCuYsNpt6wZqBx4dh4qTIAlEQh7OCh5KEUVNQEdPXiYJggQOBEAOjgQZU5EaG5XeIQWLmMzGFl4JCgMkRUoAAteOIT4uyhHZy0YbAk4exEOXKh0UtMAajGaAF8CvSmYETgIERcW1ocnbRgjcAGYSP6YGbXj+NOZqaA\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\n#29982","author":{"url":"https://github.com/ldantonov","@type":"Person","name":"ldantonov"},"datePublished":"2020-05-11T18:16:07Z","url":"https://github.com/microsoft/TypeScript/issues/38479"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:daf76ef4-cbdc-8d4e-7522-70de6ec435ee
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE304:3488ED:100DE85:1682C55:6B044AAA
html-safe-nonce332239542c3565bc6b198c4b5c362d8e0ffacbef626004025ca339ce7d40503c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzA0OjM0ODhFRDoxMDBERTg1OjE2ODJDNTU6NkIwNDRBQUEiLCJ2aXNpdG9yX2lkIjoiMjAxODc5MTk1OTg2MjQ2MzE0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac4311ec51acc594ef58968fa1071a6a3310270697fdc8f9733d2683ca8137fde2
hovercard-subject-tagissue:616082418
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/38479/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aff9bdb6f917f8f0d0b7a18445c7282e81b220ff77f8e11a477480b8bbc8258b/microsoft/TypeScript/issues/38479
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aff9bdb6f917f8f0d0b7a18445c7282e81b220ff77f8e11a477480b8bbc8258b/microsoft/TypeScript/issues/38479
og:image:altTypeScript Version: 3.8.3 Search Terms: iterator return type Code const list = ['v1', 'v2', 'v3'] const f: () => Iterator = () => { let index = 0 return { next: (): IteratorResult =...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameldantonov
hostnamegithub.com
expected-hostnamegithub.com
Noned4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/38479#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F38479
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F38479
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/38479
Reloadhttps://github.com/microsoft/TypeScript/issues/38479
Reloadhttps://github.com/microsoft/TypeScript/issues/38479
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests320 (320)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/38479
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/38479
IteratorResult definition conflicts with the JS spechttps://github.com/microsoft/TypeScript/issues/38479#top
https://github.com/rbuckton
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%22
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
TypeScript 5.7.0https://github.com/microsoft/TypeScript/milestone/208
https://github.com/ldantonov
Lubo Antonov (ldantonov)https://github.com/ldantonov
on May 11, 2020https://github.com/microsoft/TypeScript/issues/38479#issue-616082418
Iteration Protocolshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
https://www.typescriptlang.org/play?#code/MYewdgzgLgBANgS2jAvDA2gcgG4EZMA0MOATIcdgMyYC6AUHaJLAGYBcMAFAJSoB8MAJJQApgCcAhlBBiAPNDEIwAcwFoe-GAG86MeCNhKAJiIAeqGAAZdMMQYCuYsNpt6wZqBx4dh4qTIAlEQh7OCh5KEUVNQEdPXiYJggQOBEAOjgQZU5EaG5XeIQWLmMzGFl4JCgMkRUoAAteOIT4uyhHZy0YbAk4exEOXKh0UtMAajGaAF8CvSmYETgIERcW1ocnbRgjcAGYSP6YGbXj+NOZqaAhttps://www.typescriptlang.org/play#code/MYewdgzgLgBANgS2jAvDA2gcgG4EZMA0MOATIcdgMyYC6AUHaJLAGYBcMAFAJSoB8MAJJQApgCcAhlBBiAPNDEIwAcwFoe-GAG86MeCNhKAJiIAeqGAAZdMMQYCuYsNpt6wZqBx4dh4qTIAlEQh7OCh5KEUVNQEdPXiYJggQOBEAOjgQZU5EaG5XeIQWLmMzGFl4JCgMkRUoAAteOIT4uyhHZy0YbAk4exEOXKh0UtMAajGaAF8CvSmYETgIERcW1ocnbRgjcAGYSP6YGbXj+NOZqaA
#29982https://github.com/microsoft/TypeScript/issues/29982
Nexthttps://github.com/microsoft/TypeScript/issues/38479?timeline_page=1
https://github.com/IllusionMH
Andrii Dieiev (IllusionMH)https://github.com/IllusionMH
on May 12, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-627437342
https://github.com/microsoft/TypeScript/pull/30790/files#r282595851https://github.com/microsoft/TypeScript/pull/30790/files#r282595851
https://github.com/ldantonov
Lubo Antonov (ldantonov)https://github.com/ldantonov
on May 12, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-627508375
https://github.com/IllusionMH
Andrii Dieiev (IllusionMH)https://github.com/IllusionMH
on May 12, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-627626176
https://github.com/ldantonov
Lubo Antonov (ldantonov)https://github.com/ldantonov
on May 17, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-629824963
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
on Jun 5, 2020https://github.com/microsoft/TypeScript/issues/38479#event-3413460071
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Ron Buckton (rbuckton)https://github.com/rbuckton
on Jun 5, 2020https://github.com/microsoft/TypeScript/issues/38479#event-3413460185
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0https://github.com/microsoft/TypeScript/milestone/114
on Jun 5, 2020https://github.com/microsoft/TypeScript/issues/38479#event-3413460257
https://github.com/fatcerberus
Bruce Pascoe (fatcerberus)https://github.com/fatcerberus
on Jun 11, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-642828123
https://github.com/rbuckton
Ron Buckton (rbuckton)https://github.com/rbuckton
on Jun 27, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-650466008
Andrii Dieiev (@IllusionMH)https://github.com/IllusionMH
Playground examplehttps://www.typescriptlang.org/play/index.html#code/JYOwLgpgTgZghgYwgAgJIEYA8AVAfMgbwFgAoZZGACgA8AuZbASnoDcB7YAEwG5SBfUqU4QEAGzhQUCNiADOYZG3Tp6GTCACuAWwBG0XLxJL0AOiqNuyAPRXk1ZMFnIQbBWwAOYYDLijkcEE5kWQALNg1RThAAcgU9QRJhMQkpGXlFdAAmVSx2LgNSJUyzSgtrW3tHRU9vEF8E0EhYRBRUTJx8YjI7emxDcgBPejAoDQhDARJSaTk3TJU0ds1dfWQAXkJkIeQRseQ+Sxs7Z1dqrx8-AKDQ8MiYuIhptLnsxcw8znwNgi3h0ZQDuVji43DULsgdBoFO42LJZMAdKIBshpBEgnoTJigA
Daniel Rosenwasser (@DanielRosenwasser)https://github.com/DanielRosenwasser
https://github.com/fatcerberus
Bruce Pascoe (fatcerberus)https://github.com/fatcerberus
on Jun 27, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-650478815
Ron Buckton (@rbuckton)https://github.com/rbuckton
https://github.com/ldantonov
Lubo Antonov (ldantonov)https://github.com/ldantonov
on Jun 29, 2020https://github.com/microsoft/TypeScript/issues/38479#issuecomment-651183699
Bruce Pascoe (@fatcerberus)https://github.com/fatcerberus
Iterator spechttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0https://github.com/microsoft/TypeScript/milestone/114
Typescript 4.0.1https://github.com/microsoft/TypeScript/milestone/123
on Jun 29, 2020https://github.com/microsoft/TypeScript/issues/38479#event-3493752188
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
on Aug 31, 2020https://github.com/microsoft/TypeScript/issues/38479#event-3710473166
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0.1https://github.com/microsoft/TypeScript/milestone/123
on Aug 31, 2020https://github.com/microsoft/TypeScript/issues/38479#event-3710480980
https://github.com/zaach
Zach Carter (zaach)https://github.com/zaach
on Sep 21, 2022https://github.com/microsoft/TypeScript/issues/38479#issuecomment-1253080441
Jake Archibald's articlehttps://jakearchibald.com/2017/async-iterators-and-generators/
https://github.com/Amebus
Federico Ceruti (Amebus)https://github.com/Amebus
on Jan 21, 2023https://github.com/microsoft/TypeScript/issues/38479#issuecomment-1399332479
Lubo Antonov (@ldantonov)https://github.com/ldantonov
as stated in the MDNhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterator_protocol
Lubo Antonov (@ldantonov)https://github.com/ldantonov
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.8.0https://github.com/microsoft/TypeScript/milestone/163
TypeScript 5.1.0https://github.com/microsoft/TypeScript/milestone/178
on Feb 1, 2023https://github.com/microsoft/TypeScript/issues/38479#event-8413680178
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 5.1.0https://github.com/microsoft/TypeScript/milestone/178
TypeScript 5.5.0https://github.com/microsoft/TypeScript/milestone/179
on Mar 4, 2024https://github.com/microsoft/TypeScript/issues/38479#event-12004978253
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 5.5.0https://github.com/microsoft/TypeScript/milestone/179
TypeScript 5.7.0https://github.com/microsoft/TypeScript/milestone/208
on Jul 26, 2024https://github.com/microsoft/TypeScript/issues/38479#event-13666322984
Ron Buckton (rbuckton)https://github.com/rbuckton
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%22
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Aug 15, 2024https://github.com/microsoft/TypeScript/issues/38479#event-13898006899
https://github.com/rbuckton
Ron Buckton (rbuckton)https://github.com/rbuckton
on Aug 15, 2024https://github.com/microsoft/TypeScript/issues/38479#issuecomment-2291579083
Ron Buckton (rbuckton)https://github.com/rbuckton
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 15, 2024https://github.com/microsoft/TypeScript/issues/38479#event-13898008624
microsofthttps://github.com/microsoft
on Oct 21, 2025https://github.com/microsoft/TypeScript/issues/38479#event-20416960374
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/38479
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/38479
Ron Buckton (rbuckton)https://github.com/rbuckton
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%22
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
TypeScript 5.7.0https://github.com/microsoft/TypeScript/milestone/208
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.