microsoft / microsoft/TypeScript

TS hangs up entire computer, type of variables stuck at "Loading..."

Aperta
#58,373 21 commenti 1 reazione 1 assegnatario Vedi su GitHub

@ahejlsberg ci sta già lavorando.

Dal 2/5/2024.

Bug Domain: Performance
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

🔎 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..."

image

This is followed by a high spike in CPU and RAM usage

image

The icon to the bottom right showing TS server status keeps spinning followed followed by the spike in CPU and RAM usage mentioned above.

image

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.

https://github.com/microsoft/TypeScript/issues/35512
https://github.com/microsoft/vscode/issues/87870

🙂 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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.