René's URL Explorer Experiment


Title: TSC watch / Out of memory errors with recursive template literal types · Issue #47419 · microsoft/TypeScript · GitHub

Open Graph Title: TSC watch / Out of memory errors with recursive template literal types · Issue #47419 · microsoft/TypeScript

X Title: TSC watch / Out of memory errors with recursive template literal types · Issue #47419 · microsoft/TypeScript

Description: Bug Report When using watch and template literal recursion, TSC tends to run out of memory. How soon depends on the platform and memory size, but on a powerful Silicon Mac , it takes 2-3 modifications to the code base. On a memory-limite...

Open Graph Description: Bug Report When using watch and template literal recursion, TSC tends to run out of memory. How soon depends on the platform and memory size, but on a powerful Silicon Mac , it takes 2-3 modificati...

X Description: Bug Report When using watch and template literal recursion, TSC tends to run out of memory. How soon depends on the platform and memory size, but on a powerful Silicon Mac , it takes 2-3 modificati...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TSC watch / Out of memory errors with recursive template literal types","articleBody":"# Bug Report\r\n\r\nWhen using watch and template literal recursion, TSC tends to run out of memory. How soon depends on the platform and memory size, but on a powerful Silicon Mac , it takes 2-3 modifications to the code base. On a memory-limited Ubuntu VM, a single save after the initial compilation will error out.\r\n\r\n### 🔎 Search Terms\r\n\r\nwatch\r\nrecursion\r\ntemplate literal types\r\nmemory\r\nheap\r\n\r\n### 🕗 Version & Regression Information\r\n\r\nTested with 4.4, 4.5, and nightly. Happens in all, consistently.\r\n\r\nTested on MacOS Silicon and Ubuntu.\r\n\r\nPlease keep and fill in the line that best applies:\r\n- This is a crash\r\n\r\n### ⏯ Playground Link\r\nThis uses tsc watch, so a link to the playground is not possible. I provide sample code below.\r\n\r\n### 💻 Code\r\nhttps://github.com/silviogutierrez/tsc-recursion-bug\r\n\r\nUsing node 14 and yarn.\r\n\r\nTo run into the issue:\r\n1. `git clone https://github.com/silviogutierrez/tsc-recursion-bug.git`\r\n2. `yarn tsc --noEmit --watch`\r\n3. Note the initial compilation is very fast.\r\n4. Open an editor and materially change `client/routes.tsx`. Change the name, etc.\r\n5. Further compilations are slow, and eventually you'll get a massive out of memory error. \r\n\r\n### 🙁 Actual behavior\r\n\r\nOut of memory error with a long stack trace. Very little info on why.\r\n\r\n### 🙂 Expected behavior\r\n\r\nQuick compilation that takes about the same time as the initial compilation. Not only is it much slower when it does work, but it crashes eventually.\r\n\r\n### More background\r\nThe issue is caused by ExtractRouteParams in `monoroutes.tsx`. If you replace the definition with:\r\n\r\n`type ExtractRouteParams\u003cT> = any`\r\n\r\nThe problem immediately goes away. Obviously this isn't what we want. You can review `routes.tsx` to see the intent of this type. That is, to strongly type params between string and numbers.\r\n\r\nMoreover, the problem is related to `route` being a recursive function. See `routes.tsx` for an example of how it's used to create sub routes that share paths.\r\n\r\nOther things that \"fix\" the error: \r\n\r\n- Eliminate `innerRoute` from `monoroutes.tsx`, limiting routes to a single level.\r\n- Make `ExtractRouteParams` less powerful. Make it only parse params instead of string/number. Like so:\r\n- \r\n```\r\ntype ExtractRouteParams\u003cT> = string extends T\r\n    ? Record\u003cstring, string | number>\r\n    : T extends `${infer _Start}\u003c${infer Param}>/${infer Rest}`\r\n    ? ExtractRouteParams\u003c_Start> & {[k in Param]: string} & ExtractRouteParams\u003cRest>\r\n    : T extends `${infer _Start}\u003c${infer Param}>`\r\n    ? {[k in Param]: string}\r\n    : {};\r\n```\r\n\r\nHappy to provide more context. Normally I would say this is a real edge case, but the fact that it *only* affects `watch` functionality and not the initial compile leads me to believe it needs to be addressed. Thanks for all the work on typescript!","author":{"url":"https://github.com/silviogutierrez","@type":"Person","name":"silviogutierrez"},"datePublished":"2022-01-13T05:02:45Z","url":"https://github.com/microsoft/TypeScript/issues/47419"}

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:9f064aca-173b-ab19-e9e8-f65bc38761b2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id835E:E3C4F:3199596:3F4F408:6B01D8A4
html-safe-nonce33b34cf9a04410e515913c1c2d01065a73750c19bcee4bef0893d81f29be7a06
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzVFOkUzQzRGOjMxOTk1OTY6M0Y0RjQwODo2QjAxRDhBNCIsInZpc2l0b3JfaWQiOiI0OTAwNTMwNjQ1NDE3MTg3NDkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5936c1d7b932286b02bc0063a829750c07ceb14efcfb676b10e6eeac430c2a31
hovercard-subject-tagissue:1101209938
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/47419/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a415b284d9caaee7e8dbcc3e0d72c83973f3c70e6263d8e1674c60ca68f9a5b1/microsoft/TypeScript/issues/47419
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a415b284d9caaee7e8dbcc3e0d72c83973f3c70e6263d8e1674c60ca68f9a5b1/microsoft/TypeScript/issues/47419
og:image:altBug Report When using watch and template literal recursion, TSC tends to run out of memory. How soon depends on the platform and memory size, but on a powerful Silicon Mac , it takes 2-3 modificati...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesilviogutierrez
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/47419#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F47419
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%2F47419
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/47419
Reloadhttps://github.com/microsoft/TypeScript/issues/47419
Reloadhttps://github.com/microsoft/TypeScript/issues/47419
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/47419
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/47419
TSC watch / Out of memory errors with recursive template literal typeshttps://github.com/microsoft/TypeScript/issues/47419#top
https://github.com/jakebailey
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%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
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
TypeScript 4.8.0https://github.com/microsoft/TypeScript/milestone/163
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Jan 13, 2022https://github.com/microsoft/TypeScript/issues/47419#issue-1101209938
https://github.com/silviogutierrez/tsc-recursion-bughttps://github.com/silviogutierrez/tsc-recursion-bug
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 Jan 18, 2022https://github.com/microsoft/TypeScript/issues/47419#event-5913716564
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Jake Bailey (jakebailey)https://github.com/jakebailey
on Jan 18, 2022https://github.com/microsoft/TypeScript/issues/47419#event-5913716940
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.7.0https://github.com/microsoft/TypeScript/milestone/156
on Jan 18, 2022https://github.com/microsoft/TypeScript/issues/47419#event-5913717232
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Jan 25, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1020679364
#43973https://github.com/microsoft/TypeScript/pull/43973
#43733https://github.com/microsoft/TypeScript/pull/43733
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Jan 25, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1020792127
Jake Bailey (@jakebailey)https://github.com/jakebailey
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Jan 25, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1021625834
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Jan 26, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1022534974
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Apr 1, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1086135952
Jake Bailey (@jakebailey)https://github.com/jakebailey
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 4, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1087846972
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Apr 4, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1087913729
Jake Bailey (@jakebailey)https://github.com/jakebailey
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 4, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1087928097
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Apr 6, 2022https://github.com/microsoft/TypeScript/issues/47419#event-6375496334
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 6, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1089573518
Silvio (@silviogutierrez)https://github.com/silviogutierrez
#48581https://github.com/microsoft/TypeScript/pull/48581
https://www.npmjs.com/package/@typescript-deploys/pr-build/v/4.7.0-pr-48581-7https://www.npmjs.com/package/@typescript-deploys/pr-build/v/4.7.0-pr-48581-7
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 6, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1090541453
Jake Bailey (jakebailey)https://github.com/jakebailey
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Apr 6, 2022https://github.com/microsoft/TypeScript/issues/47419#event-6382231084
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Apr 7, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1092203571
Jake Bailey (@jakebailey)https://github.com/jakebailey
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 19, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1103176340
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Apr 19, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1103184134
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 19, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1103187508
https://user-images.githubusercontent.com/5341706/164104214-7d50b441-eaeb-4d5b-983f-38f2564a2cff.png
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Apr 20, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1104275417
https://github.com/silviogutierrez/tsc-recursion-bughttps://github.com/silviogutierrez/tsc-recursion-bug
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 25, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1108828729
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 25, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1108830714
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Apr 26, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1110218463
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Apr 26, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1110222028
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Apr 27, 2022https://github.com/microsoft/TypeScript/issues/47419#event-6508690634
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 May 13, 2022https://github.com/microsoft/TypeScript/issues/47419#event-6608086258
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.7.0https://github.com/microsoft/TypeScript/milestone/156
TypeScript 4.8.0https://github.com/microsoft/TypeScript/milestone/163
on May 13, 2022https://github.com/microsoft/TypeScript/issues/47419#event-6608094309
https://github.com/silviogutierrez
Silvio (silviogutierrez)https://github.com/silviogutierrez
on Jul 27, 2022https://github.com/microsoft/TypeScript/issues/47419#issuecomment-1196151480
Jake Bailey (@jakebailey)https://github.com/jakebailey
Silvio (silviogutierrez)https://github.com/silviogutierrez
not plannedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Jul 27, 2022https://github.com/microsoft/TypeScript/issues/47419#event-7068976046
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/47419
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/47419
Jake Bailey (jakebailey)https://github.com/jakebailey
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%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
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
TypeScript 4.8.0https://github.com/microsoft/TypeScript/milestone/163
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.