René's URL Explorer Experiment


Title: createProgarm with @typescript/vfs fails for target ES2021 · Issue #47273 · microsoft/TypeScript · GitHub

Open Graph Title: createProgarm with @typescript/vfs fails for target ES2021 · Issue #47273 · microsoft/TypeScript

X Title: createProgarm with @typescript/vfs fails for target ES2021 · Issue #47273 · microsoft/TypeScript

Description: Bug Report createProgram fails with internal error when using @typescript/vfs and setting compiler option target to ES2021. This issue only happens for ES2021, all other targets work fine. 🔎 Search Terms ES2021, createProgram, @typescrip...

Open Graph Description: Bug Report createProgram fails with internal error when using @typescript/vfs and setting compiler option target to ES2021. This issue only happens for ES2021, all other targets work fine. 🔎 Search...

X Description: Bug Report createProgram fails with internal error when using @typescript/vfs and setting compiler option target to ES2021. This issue only happens for ES2021, all other targets work fine. 🔎 Search...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"createProgarm with @typescript/vfs fails for target ES2021","articleBody":"# Bug Report\r\n\r\n`createProgram` fails with internal error when using @typescript/vfs and setting compiler option target to ES2021. This issue only happens for `ES2021`, all other targets work fine.\r\n\r\n### 🔎 Search Terms\r\n\r\n\u003c!--\r\n  What search terms did you use when trying to find an existing bug report?\r\n  List them here so people in the future can find this one more easily.\r\n-->\r\nES2021, createProgram, @typescript/vfs, vfs\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n\u003c!-- When did you start seeing this bug occur?\r\n\r\n\"Bugs\" that have existed in TS for a long time are very likely to be FAQs; refer to\r\n  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs\r\n\r\nIf possible, please try testing the nightly version of TS to see if it's already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n\r\nNote: The TypeScript Playground can be used to try older versions of TypeScript.\r\n\r\nPlease keep and fill in the line that best applies:\r\n-->\r\n- This changed between versions 4.4.x and 4.5.x\r\n\r\nFull version information:\r\n- typescript@4.6.0-dev.20211230\r\n- @typescript/vfs@1.3.5\r\n\r\n### ⏯ Playground Link\r\n\r\nReproduction requires import of `typescript` and `@typescript/vfs`. Playground doesn't appear to support this.\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well-->\r\n\r\n```ts\r\nimport ts, { createProgram, ScriptTarget } from 'typescript';\r\nimport { createDefaultMapFromNodeModules, createSystem, createVirtualCompilerHost } from '@typescript/vfs';\r\n\r\nconst compilerOptions = { target: ScriptTarget.ES2021 };\r\nconst code = 'export default \"foo\"';\r\n\r\nconst fsMap = createDefaultMapFromNodeModules(compilerOptions, ts);\r\nfsMap.set('index.tsx', code);\r\nconst host = createVirtualCompilerHost(createSystem(fsMap), compilerOptions, ts);\r\n\r\nconst program = createProgram({\r\n  rootNames: [...fsMap.keys()],\r\n  options: compilerOptions,\r\n  host: host.compilerHost,\r\n});\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nAbove snippet fails with following error:\r\n\r\n```\r\n/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:10460\r\n        scan: while (pos >= 0 && pos \u003c text.length) {\r\n                                            ^\r\nTypeError: Cannot read property 'length' of undefined\r\n    at iterateCommentRanges (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:10460:45)\r\n    at reduceEachLeadingCommentRange (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:10551:16)\r\n    at Object.getLeadingCommentRanges (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:10566:16)\r\n    at Object.getJSDocCommentRanges (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:15263:16)\r\n    at addJSDocComment (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:30878:42)\r\n    at parseSourceFileWorker (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:30851:34)\r\n    at Object.parseSourceFile (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:30683:26)\r\n    at Object.createSourceFile (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:30481:29)\r\n    at Object.getSourceFile (/local/home/dppilche/typescript-vfs-bug/node_modules/@typescript/vfs/src/index.ts:504:16)\r\n    at findSourceFileWorker (/local/home/dppilche/typescript-vfs-bug/node_modules/typescript/lib/typescript.js:115369:29)\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\n\u003c!-- What you expected to happen instead, and why -->\r\n\r\n`createProgram` does not crash.","author":{"url":"https://github.com/dpilch","@type":"Person","name":"dpilch"},"datePublished":"2021-12-30T16:44:08Z","url":"https://github.com/microsoft/TypeScript/issues/47273"}

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:b310c60c-6df1-5481-e5cd-c5174e2af50a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDD98:3D97C8:2388E3C:2F44F92:6B01935C
html-safe-nonceea97e28e245a1993d102acb8433bcd5493aecd0e17e9c017cac21c8d95bc9283
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDk4OjNEOTdDODoyMzg4RTNDOjJGNDRGOTI6NkIwMTkzNUMiLCJ2aXNpdG9yX2lkIjoiMzM0MTY4NzkzMzM3NDY2NTU2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9f12e40b55e397f2d04cb1e2b7501f9fd78d41114b98d07018c963bd3905c9a0
hovercard-subject-tagissue:1091205780
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/47273/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5fd3339f0a4cfcc9b7f0a75e75402a909aebd3c88adb569b1bba8d8e6f6a96ae/microsoft/TypeScript/issues/47273
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5fd3339f0a4cfcc9b7f0a75e75402a909aebd3c88adb569b1bba8d8e6f6a96ae/microsoft/TypeScript/issues/47273
og:image:altBug Report createProgram fails with internal error when using @typescript/vfs and setting compiler option target to ES2021. This issue only happens for ES2021, all other targets work fine. 🔎 Search...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedpilch
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/47273#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F47273
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%2F47273
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/47273
Reloadhttps://github.com/microsoft/TypeScript/issues/47273
Reloadhttps://github.com/microsoft/TypeScript/issues/47273
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/47273
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/47273
createProgarm with @typescript/vfs fails for target ES2021https://github.com/microsoft/TypeScript/issues/47273#top
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: ParserThe parser didn't handle the syntax correctlyhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Parser%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/dpilch
Dane Pilcher (dpilch)https://github.com/dpilch
on Dec 30, 2021https://github.com/microsoft/TypeScript/issues/47273#issue-1091205780
https://github.com/suin
suinhttps://github.com/suin
on Jan 10, 2022https://github.com/microsoft/TypeScript/issues/47273#issuecomment-1008507513
https://github.com/microsoft/TypeScript-Website/blob/c1050864dbc359cfa957aa8b52db624cd379ddcf/packages/typescript-vfs/src/index.ts#L154-L160https://github.com/microsoft/TypeScript-Website/blob/c1050864dbc359cfa957aa8b52db624cd379ddcf/packages/typescript-vfs/src/index.ts#L154-L160
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Help Wantedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Help%20Wanted%22
on Jan 11, 2022https://github.com/microsoft/TypeScript/issues/47273#event-5876457753
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Jan 11, 2022https://github.com/microsoft/TypeScript/issues/47273#event-5876457881
https://github.com/dpilch
Dane Pilcher (dpilch)https://github.com/dpilch
on Jan 18, 2022https://github.com/microsoft/TypeScript/issues/47273#issuecomment-1015589312
https://github.com/microsoft/TypeScript-Website/blob/fa4d8d29eaa2046a9c68234b3728c9cb69078045/packages/typescript-vfs/src/index.ts#L200https://github.com/microsoft/TypeScript-Website/blob/fa4d8d29eaa2046a9c68234b3728c9cb69078045/packages/typescript-vfs/src/index.ts#L200
https://github.com/Matsuuu
Matsu (Matsuuu)https://github.com/Matsuuu
on Apr 25, 2023https://github.com/microsoft/TypeScript/issues/47273#issuecomment-1521245381
microsoft/TypeScript-Website#2801https://github.com/microsoft/TypeScript-Website/issues/2801
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Domain: ParserThe parser didn't handle the syntax correctlyhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Parser%22
on Oct 16, 2025https://github.com/microsoft/TypeScript/issues/47273#event-20330904440
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Sep 8, 2026https://github.com/microsoft/TypeScript/issues/47273#issuecomment-5585276839
TypeScript-Website PR #2802https://github.com/microsoft/TypeScript-Website/pull/2802
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
Needs Human ReviewThis issue has a backlog check awaiting maintainer review.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Human%20Review%22
on Sep 8, 2026https://github.com/microsoft/TypeScript/issues/47273#event-30755062223
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 8, 2026https://github.com/microsoft/TypeScript/issues/47273#event-30755063356
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Needs Human ReviewThis issue has a backlog check awaiting maintainer review.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Human%20Review%22
on Sep 23, 2026https://github.com/microsoft/TypeScript/issues/47273#event-31701989192
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/47273
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/47273
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: ParserThe parser didn't handle the syntax correctlyhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Parser%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
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.