Repository navigation
TS hangs up entire computer, type of variables stuck at "Loading..." #58373
Description
🔎 Search Terms
TS intellisense not working, TS hangs up entire PC, Type inference not working
🕗 Version & Regression Information
- This is a crash using version 5.4.5
- I tried versions 5.4.3, 5.4.5, and 5.5
- This issue sprung up out of nowhere, I have no idea about the origin
⏯ Reproduction steps
To reproduce this issue please clone the following repository - https://github.com/slyofzero/TONBuyBot
Install the packages using pnpm - pnpm i
Visit the file - ./src/bot/commands/index.ts
💻 Code
The file code in question is very tame -
import { teleBot } from "@/index";
import { startBot } from "./start";
import { log, errorHandler } from "@/utils/handlers";
import { settings } from "./settings";
import { setEmojiCommand } from "./setEmoji";
import { stopBot } from "./stop";
import { setGifCommand } from "./setGif";
export function initiateBotCommands() {
teleBot.api
.setMyCommands([
{ command: "start", description: "Start the bot" },
{ command: "stop", description: "Stop the bot" },
{ command: "settings", description: "To customize the bot" },
{ command: "setemoji", description: "To set an emoji" },
{ command: "setgif", description: "To set a GIF" },
])
.catch((e) => errorHandler(e));
teleBot.command("start", (ctx) => startBot(ctx));
teleBot.command("stop", (ctx) => stopBot(ctx));
teleBot.command("settings", (ctx) => settings(ctx));
teleBot.command("setemoji", (ctx) => setEmojiCommand(ctx));
teleBot.hears(/\/setgif/, (ctx) => setGifCommand(ctx, true));
// @ts-expect-error CTX type invalid
teleBot.on(":animation", (ctx) => setGifCommand(ctx));
log("Bot commands up");
}The above code is used to setup a telegram bot's commands using grammy.js
🙁 Actual behavior
Update - The issue only occurs when I open the ./src/bot/commands/index.ts file of the repository I share above in reproduction steps.
Uptil yesterday night VSCode and Typescript Intellisense worked fine but now types of variables upon hovering are indefinitely stuck at "Loading..."
This is followed by a high spike in CPU and RAM usage
The icon to the bottom right showing TS server status keeps spinning followed followed by the spike in CPU and RAM usage mentioned above.
Because of all these issues, using the computer with the project on is next to impossible. Typescript syntax errors, Intellisense, or Type inference, nothing works. I first tried uninstalling and reinstalling VSCode but that didn't fix it. I formatted by hard drive and reinstalled my OS but the problem still persists. I have gone through the below two issues that sounds similar to my problem but haven't found a fix yet.
🙂 Expected behavior
The expected behaviour would be smooth Intellisense, type inference, and an average usage of CPU and RAM not affecting other functionalities of my PC.
Additional information about the issue
I have tried this issue on two different devices and two different OS and been able to reproduce on both.
First device was an i3, 8GB RAM Dell Inspiron 5482 with Windows 10
Second device is an AMD Ryzen 7 6800, 32GB RAM, 8GB RTX 3070, Lenovo Legion 5 Pro with Windows 11



Activity
RyanCavanaugh commentedon May 2, 2024
We need a way to reproduce this
slyofzero commentedon May 2, 2024
I have updated the original issue with reproduction steps and additional information about how I have tested it
RyanCavanaugh commentedon May 2, 2024
tscis also not terminating in a reasonable amount of time. Bisecting...RyanCavanaugh commentedon May 2, 2024
Bisects to #57345
RyanCavanaugh commentedon May 2, 2024
Using just
grammyas a dependency:RyanCavanaugh commentedon May 2, 2024
Before
After
RyanCavanaugh commentedon May 2, 2024
Basically stuck here:
Andarist commentedon May 2, 2024
and there go my weekend plans... 😭
RyanCavanaugh commentedon May 2, 2024
Anders Hejlsberg (@ahejlsberg) assigning to you since #57343 also was, but sounds like Mateusz Burzyński (@Andarist) might be working on it?
slyofzero commentedon May 3, 2024
what seems to be the issue here? grammy.js is at fault?
fatcerberus commentedon May 3, 2024
No, TS is. It's a regression caused by a change that was made in the linked PR (#57345), which was found via
git bisect.grammyjust happens to be the module that triggers the bug.ahejlsberg commentedon May 3, 2024
Ryan Cavanaugh (@RyanCavanaugh) I'm unable to reproduce with the examples here and here. The second example (after uncommenting the constraint) shows this:
This is with the compiler in main branch, following
tsc -initandnpm i grammy. Am I missing something?RyanCavanaugh commentedon May 3, 2024
Anders Hejlsberg (@ahejlsberg) Try this? https://github.com/RyanCavanaugh/repro-58373
Relevant numbers on main
ahejlsberg commentedon May 3, 2024
Ok, I can reproduce with your repo. The difference is you're using an older version of
grammy, 1.20.3. Current version on NPM is 1.22.4 and it doesn't have a problem.ahejlsberg commentedon May 3, 2024
See grammyjs/grammY#553. Looks like this is a known issue that was fixed by in the latest
grammy. I'd still be interested in knowing why #57345 slowed down the old types, but appears there's a simple workaround.Andarist commentedon Jun 3, 2024
I'm still working on minimizing this further but I want to share a single-file repro created based on the code from grammy. Some parts of this probably no longer make sense (I remove bits that make sense for what their types want to achieve but which are not relevant for the repro):
repro
I will continue working on this - so far, what I was able to notice is that
AliasPropsbeing a renaming mapped type impacts this.mohitxskull commentedon Feb 4, 2025
Hi Mateusz Burzyński (@Andarist). I'm having a similar issue as Ishan Shishodiya (@slyofzero).
I would like to add an issue for a project in my repo that is encountering this same hangup. I have tried various things, but none of them work. I hope this helps with your debugging of the error. The project is here:
https://github.com/mohitxskull/Formation
The project is available on GitHub. If you go to
frontend/src/components/ui/form/update_form.tsxafter installing withpnpm install, you will see the infinite loading when you hover over any variable, etc.Thank you so much for looking into this.
mohitxskull commentedon Feb 4, 2025
I tracked down the problem, it was because of the file
backend/app/validators/field.ts. I wasted so much time on tracking it down!I didn't see any errors, but the Typescript server hanged every time. The issue didn't happen anywhere else, and its effect was in the frontend. It makes me think there may be a bug.
Andarist commentedon Feb 4, 2025
I see I forgot to report back here. My conclusion was this example is "simply" extreme.
getReducedTypeincurs some extra work here and it adds up. Unfortunately, I don't know how to improve this.jakebailey commentedon Mar 1, 2025
DefinitelyTyped has a new OOM in
styled-components. I ran tsc for every version TS supports and the results were interesting:There was a huge jump, and as time moves on we load more and more code with newer compilers with more memory.
Bisecting the problem led to #57345, which this issue also bisects to.
I'm not super convinced that
styled-componentsis actually that extreme; wondering if there's some improvement that's possible here too...jakebailey commentedon Mar 1, 2025
That and it makes tsc 4x slower to check the types.