microsoft / microsoft/TypeScript

Memory Leak / Infinite Recursion. TS hangs, TSC never finishes, VSCode and Intellisense dies.

Open
#56,081 9 comments 17 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Needs Investigation Rescheduled
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔎 Search Terms

Typescript Hangs, Memory Leak, VS Code, Prisma, React-Hook-Form,

🕗 Version & Regression Information
  • This is a crash

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about hanging.

Tested on latest 5.2.2 and 5.3.0-dev-20231012. typescript@next

⏯ Playground Link

https://codesandbox.io/p/sandbox/musing-turing-78vp6j?file=%2Fapp%2Fpage.tsx%3A6%2C33

💻 Code
import { useForm } from "react-hook-form";
import { Prisma } from "@prisma/client";

export default function Home() {
  const form = useForm<Prisma.UserCreateInput>();
  ...

This will hang everything. Typescript won't tsc and intellisense will just sit with "loading" no matter what you hover.

meanwhile this works fine:

import { useForm } from "react-hook-form";
import { Prisma } from "@prisma/client";

export default function Home() {
  const form = useForm<>();
  ...

tsc --noEmit --extendedDiagnostics will complete in like 3 seconds with this.

🙁 Actual behavior

Typescript won't complete a tsc --noEmit and intellisense will just sit with "loading" no matter what you hover over. I have seen it once before just set everything to any

With the generated types in the first example - i let it run for 1 hour 59mins on a M1 mac and no output.

You can see the full code example with a minimal repro on the codesandbox link. It also hangs it's intellisense in CSB and won't tsc.
CPU also goes to 100% on both local and CSB

🙂 Expected behavior

Doesn't hang typescript, operates just like if you put any other type in there say

type SomeType = {name: string} 
const form = useForm<SomeType>() 
Additional information about the issue

Another report by someone else here:

https://stackoverflow.com/questions/76932600/high-cpu-usage-when-using-some-prisma-types-with-react-hook-form

It seems to be anything that comes off the Prisma.* types

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.