Repository: TypeScript
Issue: Slow IntelliSense with react-hook-form resolvers on commands `completionInfo`, `completionEntryDetails`, and, `encodedSemanticClassifications-full`
Labels: Needs Investigation,Domain: Performance

# Bug Report

When adding react-hook-form with their resolver library and zod, the IntelliSense time blows up on three commands: `completionInfo`, `completionEntryDetails`, and, `encodedSemanticClassifications-full`.

Before adding the resolver the logs output:
```
Info 139  [22:19:17.358] getCompletionData: Get current token: 0.021499991416931152
Info 140  [22:19:17.358] getCompletionData: Is inside comment: 0.057999998331069946
Info 141  [22:19:17.358] getCompletionData: Get previous token: 0.05949999392032623
Info 142  [22:19:17.358] getCompletionsAtPosition: isCompletionListBlocker: 0.26919999718666077
Info 143  [22:19:17.369] getExportInfoMap: cache miss or empty; calculating new results
Info 144  [22:19:17.382] getExportInfoMap: done in 19.083700001239777 ms
Info 145  [22:19:17.394] collectAutoImports: resolved 4 module specifiers, plus 0 ambient and -3 from cache
Info 146  [22:19:17.394] collectAutoImports: response is complete
Info 147  [22:19:17.394] collectAutoImports: 4.513700008392334
Info 148  [22:19:17.394] getCompletionData: Semantic work: 35.378199994564056
Info 149  [22:19:17.413] getCompletionsAtPosition: getCompletionEntriesFromSymbols: 19.212099999189377
Perf 150  [22:19:17.422] 27::completionInfo: elapsed time (in milliseconds) 70.9448

Info 159  [22:19:17.525] getCompletionData: Get current token: 0.03389999270439148
Info 160  [22:19:17.525] getCompletionData: Is inside comment: 0.008000001311302185
Info 161  [22:19:17.526] getCompletionData: Get previous token: 0.07129999995231628
Info 162  [22:19:17.526] getCompletionsAtPosition: isCompletionListBlocker: 0.010899990797042847
Info 163  [22:19:17.528] getCompletionData: Semantic work: 2.452999994158745
Perf 164  [22:19:17.732] 29::completionEntryDetails: elapsed time (in milliseconds) 212.3927

Perf 179  [22:19:17.974] 34::encodedSemanticClassifications-full: elapsed time (in milliseconds) 163.9209
```

After adding the resolver the logs output:
```
Info 323  [22:22:49.786] getCompletionData: Get current token: 0.04549999535083771
Info 324  [22:22:49.786] getCompletionData: Is inside comment: 0.009299993515014648
Info 325  [22:22:49.786] getCompletionData: Get previous token: 0.12800000607967377
Info 326  [22:22:49.787] getCompletionsAtPosition: isCompletionListBlocker: 0.23919999599456787
Info 327  [22:22:49.803] getExportInfoMap: cache hit
Info 328  [22:22:49.815] collectAutoImports: resolved 7 module specifiers, plus 0 ambient and -38 from cache
Info 329  [22:22:49.815] collectAutoImports: response is complete
Info 330  [22:22:49.815] collectAutoImports: 6.50730000436306
Info 331  [22:22:49.815] getCompletionData: Semantic work: 28.06919999420643
Info 332  [22:22:50.599] getCompletionsAtPosition: getCompletionEntriesFromSymbols: 14.070700004696846
Perf 333  [22:22:50.602] 74::completionInfo: elapsed time (in milliseconds) 822.7960

Info 344  [22:22:50.762] getCompletionData: Get current token: 0.05060000717639923
Info 345  [22:22:50.762] getCompletionData: Is inside comment: 0.010499998927116394
Info 346  [22:22:50.762] getCompletionData: Get previous token: 0.10969999432563782
Info 347  [22:22:50.762] getCompletionsAtPosition: isCompletionListBlocker: 0.008100003004074097
Info 348  [22:22:50.764] getCompletionData: Semantic work: 1.965599998831749
Perf 349  [22:22:51.360] 83::completionEntryDetails: elapsed time (in milliseconds) 598.5825

Perf 444  [22:22:59.443] 108::encodedSemanticClassifications-full: elapsed time (in milliseconds) 670.2304
```

What seems to be an identical issue was previously reported in a now closed ticket (https://github.com/microsoft/TypeScript/issues/44851).

### 🔎 Search Terms

### 🕗 Version & Regression Information

As noted in the ticket Typescript 4.3 introduced the regression. When downgrading to Typescript 4.2, I do not see this issue.  The issue persists when using the PR (https://github.com/microsoft/TypeScript/pull/46429) that closed the previously reported issue (https://github.com/microsoft/TypeScript/issues/44851). The PR landed in Typescript 4.5.1-rc.

### ⏯ Playground Link

Example repo can be found:

https://github.com/JSin/type-resolve-bug

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod/dist/zod";
import { z } from "zod";

const schema = z.object({
  first: z.string().nonempty(),
  second: z.number().gte(0),
});

const Index = () => {
  /*
    If you were to pass no parameters to useForm, IntelliSense is still quick.
    Once you add the object with the resolver property with a zodResolver... IntelliSense speed blows up.
  */
  const { register } = useForm<z.infer<typeof schema>>({
    resolver: zodResolver(schema),
  });
};
```

### 🙁 Actual behavior

Extremely Slow IntelliSense

### 🙂 Expected behavior

Fast IntelliSense