René's URL Explorer Experiment


Title: Asynchronous Iterations · Issue #11326 · microsoft/TypeScript · GitHub

Open Graph Title: Asynchronous Iterations · Issue #11326 · microsoft/TypeScript

X Title: Asynchronous Iterations · Issue #11326 · microsoft/TypeScript

Description: The asynchronous iterations proposal is now in stage 3, so it should be safe to support that in TypeScript now. Currently, a function may be a generator or an async function, but it cannot be both. The asynchronous iteration proposal rem...

Open Graph Description: The asynchronous iterations proposal is now in stage 3, so it should be safe to support that in TypeScript now. Currently, a function may be a generator or an async function, but it cannot be both....

X Description: The asynchronous iterations proposal is now in stage 3, so it should be safe to support that in TypeScript now. Currently, a function may be a generator or an async function, but it cannot be both....

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Asynchronous Iterations","articleBody":"The [asynchronous iterations](https://github.com/tc39/proposal-async-iteration) proposal is now in stage 3, so it should be safe to support that in TypeScript now. Currently, a function may be a generator or an async function, but it cannot be both. The asynchronous iteration proposal removes this restriction. Here's an example from their readme:\n\n``` javascript\nasync function* readLines(path) {\n  let file = await fileOpen(path);\n\n  try {\n    while (!file.EOF) {\n      yield await file.readLine();\n    }\n  } finally {\n    await file.close();\n  }\n}\n```\n## Types\n\nGenerator functions declare several interfaces:\n\n``` typescript\ninterface IteratorResult\u003cT> {\n    done: boolean;\n    value: T;\n}\ninterface Iterator\u003cT> {\n    next(value?: any): IteratorResult\u003cT>;\n    return?(value?: any): IteratorResult\u003cT>;\n    throw?(e?: any): IteratorResult\u003cT>;\n}\ninterface Iterable\u003cT> {\n    [Symbol.iterator](): Iterator\u003cT>;\n}\ninterface IterableIterator\u003cT> extends Iterator\u003cT> {\n    [Symbol.iterator](): IterableIterator\u003cT>;\n}\n```\n\nAsync generators return promises instead of their `IteratorResult`, and use a new symbol, `Symbol.asyncIterator`:\n\n``` typescript\ninterface IteratorResult\u003cT> {\n    done: boolean;\n    value: T;\n}\ninterface AsyncIterator\u003cT> {\n    next(value?: any): Promise\u003cIteratorResult\u003cT>>;\n    return?(value?: any): Promise\u003cIteratorResult\u003cT>>;\n    throw?(e?: any): Promise\u003cIteratorResult\u003cT>>;\n}\ninterface AsyncIterable\u003cT> {\n    [Symbol.asyncIterator](): AsyncIterator\u003cT>;\n}\ninterface AsyncIterableIterator\u003cT> extends AsyncIterator\u003cT> {\n    [Symbol.asyncIterator](): AsyncIterableIterator\u003cT>;\n}\n```\n## Emit\n\nI guess that this would require another helper function to downlevel to ES2015, similar to the one used for async functions. Yield and await expression would both be replaced by yield expression, so they need to be decorated with some tag, like `yield ['await', promise]` for `await promise`.\n## for-await-of\n\nThe proposal also introduces a new loop. An example from their readme:\n\n``` javascript\nfor await (const line of readLines(filePath)) {\n  console.log(line);\n}\n```\n\nThis iterates over the `[Symbol.asyncIterator]()` object and awaits the value of `.next()`, similar to a for-of loop. This loop can only be used in async functions.\n","author":{"url":"https://github.com/ivogabe","@type":"Person","name":"ivogabe"},"datePublished":"2016-10-03T17:13:06Z","url":"https://github.com/microsoft/TypeScript/issues/11326"}

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:c952022a-859a-9341-d2d2-77dfbaf1fa51
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDAC0:311640:228FC0:2CD3D5:6B00CC7A
html-safe-noncea928dffb5f2ab805f83bde56cc854ea1119ecbf998c67f73122d06df43648342
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUMwOjMxMTY0MDoyMjhGQzA6MkNEM0Q1OjZCMDBDQzdBIiwidmlzaXRvcl9pZCI6IjM4OTk0NDc1MDA0MjMwODkyNzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaccd2213eeff9faa3593eed59ef65e1f447eabdba83e54220923ae165abfa341fe
hovercard-subject-tagissue:180694785
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/11326/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5acf85ae52e38f1fce4eacf1cd87d0fc24576144845866086734f548db02ee85/microsoft/TypeScript/issues/11326
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5acf85ae52e38f1fce4eacf1cd87d0fc24576144845866086734f548db02ee85/microsoft/TypeScript/issues/11326
og:image:altThe asynchronous iterations proposal is now in stage 3, so it should be safe to support that in TypeScript now. Currently, a function may be a generator or an async function, but it cannot be both....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameivogabe
hostnamegithub.com
expected-hostnamegithub.com
None98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4
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
releaseef013399cf0a3c324bea644a685d7c1e0f06b5b7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/11326#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F11326
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%2F11326
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/11326
Reloadhttps://github.com/microsoft/TypeScript/issues/11326
Reloadhttps://github.com/microsoft/TypeScript/issues/11326
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests307 (307)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/11326
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/11326
Asynchronous Iterationshttps://github.com/microsoft/TypeScript/issues/11326#top
https://github.com/rbuckton
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES NextNew featurers for ECMAScript (a.k.a. ESNext)https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES%20Next%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
TypeScript 2.3https://github.com/microsoft/TypeScript/milestone/38
https://github.com/ivogabe
Ivo Gabe de Wolff (ivogabe)https://github.com/ivogabe
on Oct 3, 2016https://github.com/microsoft/TypeScript/issues/11326#issue-180694785
asynchronous iterationshttps://github.com/tc39/proposal-async-iteration
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
ES NextNew featurers for ECMAScript (a.k.a. ESNext)https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES%20Next%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Oct 21, 2016https://github.com/microsoft/TypeScript/issues/11326#event-831567075
https://github.com/appsforartists
Brenton Simpson (appsforartists)https://github.com/appsforartists
on Nov 14, 2016https://github.com/microsoft/TypeScript/issues/11326#issuecomment-260248836
emits garbagehttps://www.typescriptlang.org/play/index.html#src=async%20function%20streamingRead%28%29%20%7B%0D%0A%20%20const%20response%20%3D%20await%20fetch%28'https%3A%2F%2Fhtml.spec.whatwg.org'%29%3B%0D%0A%20%20const%20reader%20%3D%20response.body.getReader%28%29%3B%0D%0A%20%20%0D%0A%20%20for%20await%20%28const%20value%20of%20reader%29%20%7B%0D%0A%20%20%20%20console.log%28%60Read%20%24%7Bvalue.length%7D%20bytes%60%29%3B%0D%0A%20%20%7D%0D%0A%7D%0D%0A%0D%0A%2F%2F%20polyfill%20for%20readable%20streams%20to%20be%20async%20iterables%0D%0Anew%20ReadableStream%28%29.getReader%28%29.constructor.prototype%5BSymbol.asyncIterator%5D%20%3D%20async%20function*%20readLines%28path%29%20%7B%0D%0A%20%20while%20%28true%29%20%7B%0D%0A%20%20%20%20const%20%7Bdone%2C%20value%7D%20%3D%20await%20this.read%28%29%3B%0D%0A%20%20%20%20if%20%28done%29%20return%3B%0D%0A%20%20%20%20yield%20value%3B%0D%0A%20%20%7D%0D%0A%7D%3B%0D%0A%0D%0AstreamingRead%28%29%3B
works in Babelhttps://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2017%2Cstage-0&code=async%20function%20streamingRead%28%29%20%7B%0A%20%20const%20response%20%3D%20await%20fetch%28'https%3A%2F%2Fhtml.spec.whatwg.org'%29%3B%0A%20%20const%20reader%20%3D%20response.body.getReader%28%29%3B%0A%20%20%0A%20%20for%20await%20%28const%20value%20of%20reader%29%20%7B%0A%20%20%20%20console.log%28%60Read%20%24%7Bvalue.length%7D%20bytes%60%29%3B%0A%20%20%7D%0A%7D%0A%0A%2F%2F%20polyfill%20for%20readable%20streams%20to%20be%20async%20iterables%0Anew%20ReadableStream%28%29.getReader%28%29.constructor.prototype%5BSymbol.asyncIterator%5D%20%3D%20async%20function*%20readLines%28path%29%20%7B%0A%20%20while%20%28true%29%20%7B%0A%20%20%20%20const%20%7Bdone%2C%20value%7D%20%3D%20await%20this.read%28%29%3B%0A%20%20%20%20if%20%28done%29%20return%3B%0A%20%20%20%20yield%20value%3B%0A%20%20%7D%0A%7D%3B%0A%0AstreamingRead%28%29%3B&experimental=true&loose=false&spec=false
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Nov 14, 2016https://github.com/microsoft/TypeScript/issues/11326#issuecomment-260433857
https://cloud.githubusercontent.com/assets/8000722/20279206/72ede3ea-aa5c-11e6-9868-670628362bd4.gif
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.2https://github.com/microsoft/TypeScript/milestone/34
on Dec 8, 2016https://github.com/microsoft/TypeScript/issues/11326#event-887193052
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Dec 23, 2016https://github.com/microsoft/TypeScript/issues/11326#event-903676719
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
Ron Buckton (rbuckton)https://github.com/rbuckton
on Dec 30, 2016https://github.com/microsoft/TypeScript/issues/11326#event-908391863
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.2https://github.com/microsoft/TypeScript/milestone/34
TypeScript 2.3https://github.com/microsoft/TypeScript/milestone/38
on Feb 2, 2017https://github.com/microsoft/TypeScript/issues/11326#event-945759631
https://github.com/imetallica
Iuri L. Machado (imetallica)https://github.com/imetallica
on Feb 10, 2017https://github.com/microsoft/TypeScript/issues/11326#issuecomment-279002774
https://github.com/ErikCupal
Erik Cupal (ErikCupal)https://github.com/ErikCupal
on Feb 10, 2017https://github.com/microsoft/TypeScript/issues/11326#issuecomment-279065747
Iuri L. Machado (@imetallica)https://github.com/imetallica
Ron Buckton (rbuckton)https://github.com/rbuckton
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#12346https://github.com/microsoft/TypeScript/pull/12346
on Feb 17, 2017https://github.com/microsoft/TypeScript/issues/11326#event-966093541
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
on Feb 17, 2017https://github.com/microsoft/TypeScript/issues/11326#event-967301831
microsofthttps://github.com/microsoft
on Jun 19, 2018https://github.com/microsoft/TypeScript/issues/11326#event-1689915620
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/11326
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/11326
Ron Buckton (rbuckton)https://github.com/rbuckton
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES NextNew featurers for ECMAScript (a.k.a. ESNext)https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES%20Next%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
TypeScript 2.3https://github.com/microsoft/TypeScript/milestone/38
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

Viewport: width=device-width


URLs of crawlers that visited me.