microsoft / microsoft/TypeScript

Type hinting remains slow after version 5.9.2

ๆœชๅ…ณ้—ญ
#62,484 8 ๆก่ฏ„่ฎบ 0 ไธช reaction ๅทฒๆŒ‡ๆดพ 0 ไบบ ๅœจ GitHub ๆŸฅ็œ‹

่ฟ˜ๆฒกๆœ‰ไบบ่ฎค้ข†่ฟ™ไธช Issueใ€‚

Needs More Info
ไธป่ฆ่ฏญ่จ€
Go
ๆ˜Ÿๆ ‡
111k
ๆดพ็”Ÿ
14.3k
ๅนณๅ‡ๅˆๅนถ
2 ๅคฉ 4 ๅฐๆ—ถ
30 ๅคฉๅ†…ๅˆๅนถ PR
132

ๆ่ฟฐ

### ๐Ÿ”Ž Search Terms

I use windows 10+ vscode 1.104.1+typescript 5.9.2+
I used [valibot](https://github.com/fabian-hiller/valibot) (a library similar to zod) in my project
As the code increases, the prompting speed becomes slower and slower. Now it takes about 3 seconds to prompt once (5900x 6c12t)
I have also tried using `typescript-go` for hinting, but the speed is not fast either (it's a bit faster than the current one, but it still requires waiting)
### ๐Ÿ•— Version & Regression Information

This problem has always existed, and even after the optimization of types in 5.9.2, it is still slow

### โฏ Playground Link

_No response_

### ๐Ÿ’ป Code

a lot of code define
Approximately one thousand valibot functions were utilized (estimated value; as there are still some references)
like this
```ts
export const a= v.object({
selection: v.pipe(
v.optional(v.string()),
v.description('description'),
),
common: v.pipe(
v.optional(v.string()),
v.description('description'),
),
})
```

### ๐Ÿ™ Actual behavior

Every time I enter code, I have to wait a few seconds before any prompt appears

### ๐Ÿ™‚ Expected behavior

not slow

### Additional information about the issue

I use https://github.com/microsoft/typescript-analyze-trace print some log
I hope it will be helpful to you

```
Hot Spots
โ””โ”€ Check file c:\code\my-project\script\metadata\config.ts (2364ms)
โ””โ”€ Check variable declaration from (line 264, char 14) to (line 703, char 3) (2069ms)
โ””โ”€ Check expression from (line 264, char 23) to (line 703, char 3) (2068ms)
โ””โ”€ Check expression from (line 264, char 32) to (line 703, char 2) (2056ms)
โ””โ”€ Check expression from (line 658, char 19) to (line 664, char 4) (1502ms)
โ””โ”€ Check expression from (line 659, char 5) to (line 663, char 7) (1501ms)
โ””โ”€ Check expression from (line 659, char 16) to (line 659, char 33) (1499ms)
โ””โ”€ Compare types 47331 and 1049 (1487ms)
โ””โ”€ Compare types 47331 and 942 (1486ms)
โ”œโ”€ Compare types 47342 and 1049 (876ms)
โ”‚ โ””โ”€ Compare types 47342 and 942 (876ms)
โ”‚ โ””โ”€ Compare types 47360 and 1049 (864ms)
โ”‚ โ””โ”€ Compare types 47360 and 942 (864ms)
โ”‚ โ”œโ”€ {"id":47360,"kind":"GenericInstantiation","name":"OptionalSchema","instantiatedType":564,"typeArguments":[47359,10],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":1}}
โ”‚ โ”‚ โ”œโ”€ {"id":564,"kind":"GenericType","name":"OptionalSchema","typeArguments":[565,566],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":1}}
โ”‚ โ”‚ โ”‚ โ”œโ”€ {"id":565,"kind":"TypeParameter","name":"TWrapped","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":26}}
โ”‚ โ”‚ โ”‚ โ””โ”€ {"id":566,"kind":"TypeParameter","name":"TDefault","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":93}}
โ”‚ โ”‚ โ”œโ”€ {"id":47359,"kind":"GenericInstantiation","name":"ObjectSchema","instantiatedType":858,"typeArguments":[47358,10],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":1}}
โ”‚ โ”‚ โ”‚ โ”œโ”€ {"id":858,"kind":"GenericType","name":"ObjectSchema","typeArguments":[859,860],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":1}}
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ {"id":859,"kind":"TypeParameter","name":"TEntries","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":24}}
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ {"id":860,"kind":"TypeParameter","name":"TMessage","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":56}}
โ”‚ โ”‚ โ”‚ โ”œโ”€ {"id":47358,"kind":"AnonymousType","location":{"path":"c:\code\my-project\node_modules\@cyia\llama\llama\define\index.d.ts","line":1075,"char":62}}
โ”‚ โ”‚ โ”‚ โ””โ”€ {"id":10,"kind":"Intrinsic","name":"undefined"}
โ”‚ โ”‚ โ””โ”€ {"id":10,"kind":"Intrinsic","name":"undefined"}
โ”‚ โ””โ”€ {"id":942,"kind":"GenericInstantiation","name":"ExactOptionalSchema","instantiatedType":938,"typeArguments":[428,9],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":1}}
โ”‚ โ”œโ”€ {"id":938,"kind":"GenericType","name":"ExactOptionalSchema","typeArguments":[939,940],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":1}}
โ”‚ โ”‚ โ”œโ”€ {"id":939,"kind":"TypeParameter","name":"TWrapped","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":31}}
โ”‚ โ”‚ โ””โ”€ {"id":940,"kind":"TypeParameter","name":"TDefault","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":98}}
โ”‚ โ”œโ”€ {"id":428,"kind":"GenericInstantiation","name":"BaseSchema","instantiatedType":419,"typeArguments":[9,9,427],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":1}}
โ”‚ โ”‚ โ”œโ”€ {"id":419,"kind":"GenericType","name":"BaseSchema","typeArguments":[420,421,422],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":1}}
โ”‚ โ”‚ โ”‚ โ”œโ”€ {"id":420,"kind":"TypeParameter","name":"TInput","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":22}}
โ”‚ โ”‚ โ”‚ โ”œโ”€ {"id":421,"kind":"TypeParameter","name":"TOutput","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":30}}
โ”‚ โ”‚ โ”‚ โ””โ”€ {"id":422,"kind":"TypeParameter","name":"TIssue","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":39}}
โ”‚ โ”‚ โ”œโ”€ {"id":9,"kind":"Intrinsic","name":"unknown"}
โ”‚ โ”‚ โ””โ”€ {"id":427,"kind":"GenericInstantiation","name":"BaseIssue","instantiatedType":424,"typeArguments":[9],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3850,"char":1}}
โ”‚ โ”‚ โ”œโ”€ {"id":424,"kind":"GenericType","name":"BaseIssue","typeArguments":[425],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3850,"char":1}}
โ”‚ โ”‚ โ”‚ โ””โ”€ {"id":425,"kind":"TypeParameter","name":"TInput","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3850,"char":21}}
โ”‚ โ”‚ โ””โ”€ {"id":9,"kind":"Intrinsic","name":"unknown"}
โ”‚ โ””โ”€ {"id":9,"kind":"Intrinsic","name":"unknown"}
โ””โ”€ Compare types 129323 and 1049 (609ms)
โ””โ”€ Compare types 129323 and 942 (609ms)
โ””โ”€ Compare types 129332 and 1049 (605ms)
โ””โ”€ Compare types 129332 and 942 (605ms)
โ”œโ”€ {"id":129332,"kind":"GenericInstantiation","name":"OptionalSchema","instantiatedType":564,"typeArguments":[129331,10],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":1}}
โ”‚ โ”œโ”€ {"id":564,"kind":"GenericType","name":"OptionalSchema","typeArguments":[565,566],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":1}}
โ”‚ โ”‚ โ”œโ”€ {"id":565,"kind":"TypeParameter","name":"TWrapped","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":26}}
โ”‚ โ”‚ โ””โ”€ {"id":566,"kind":"TypeParameter","name":"TDefault","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6476,"char":93}}
โ”‚ โ”œโ”€ {"id":129331,"kind":"GenericInstantiation","name":"ObjectSchema","instantiatedType":858,"typeArguments":[129330,10],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":1}}
โ”‚ โ”‚ โ”œโ”€ {"id":858,"kind":"GenericType","name":"ObjectSchema","typeArguments":[859,860],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":1}}
โ”‚ โ”‚ โ”‚ โ”œโ”€ {"id":859,"kind":"TypeParameter","name":"TEntries","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":24}}
โ”‚ โ”‚ โ”‚ โ””โ”€ {"id":860,"kind":"TypeParameter","name":"TMessage","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":6241,"char":56}}
โ”‚ โ”‚ โ”œโ”€ {"id":129330,"kind":"AnonymousType","location":{"path":"c:\code\my-project\node_modules\@cyia\llama\llama\define\index.d.ts","line":11,"char":62}}
โ”‚ โ”‚ โ””โ”€ {"id":10,"kind":"Intrinsic","name":"undefined"}
โ”‚ โ””โ”€ {"id":10,"kind":"Intrinsic","name":"undefined"}
โ””โ”€ {"id":942,"kind":"GenericInstantiation","name":"ExactOptionalSchema","instantiatedType":938,"typeArguments":[428,9],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":1}}
โ”œโ”€ {"id":938,"kind":"GenericType","name":"ExactOptionalSchema","typeArguments":[939,940],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":1}}
โ”‚ โ”œโ”€ {"id":939,"kind":"TypeParameter","name":"TWrapped","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":31}}
โ”‚ โ””โ”€ {"id":940,"kind":"TypeParameter","name":"TDefault","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":4509,"char":98}}
โ”œโ”€ {"id":428,"kind":"GenericInstantiation","name":"BaseSchema","instantiatedType":419,"typeArguments":[9,9,427],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":1}}
โ”‚ โ”œโ”€ {"id":419,"kind":"GenericType","name":"BaseSchema","typeArguments":[420,421,422],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":1}}
โ”‚ โ”‚ โ”œโ”€ {"id":420,"kind":"TypeParameter","name":"TInput","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":22}}
โ”‚ โ”‚ โ”œโ”€ {"id":421,"kind":"TypeParameter","name":"TOutput","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":30}}
โ”‚ โ”‚ โ””โ”€ {"id":422,"kind":"TypeParameter","name":"TIssue","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3277,"char":39}}
โ”‚ โ”œโ”€ {"id":9,"kind":"Intrinsic","name":"unknown"}
โ”‚ โ””โ”€ {"id":427,"kind":"GenericInstantiation","name":"BaseIssue","instantiatedType":424,"typeArguments":[9],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3850,"char":1}}
โ”‚ โ”œโ”€ {"id":424,"kind":"GenericType","name":"BaseIssue","typeArguments":[425],"location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3850,"char":1}}
โ”‚ โ”‚ โ””โ”€ {"id":425,"kind":"TypeParameter","name":"TInput","location":{"path":"c:\code\my-project\node_modules\valibot\dist\index.d.ts","line":3850,"char":21}}
โ”‚ โ””โ”€ {"id":9,"kind":"Intrinsic","name":"unknown"}
โ””โ”€ {"id":9,"kind":"Intrinsic","name":"unknown"}

Duplicate packages
โ””โ”€ undici-types
โ”œโ”€ Version 6.21.0 from C:/code/my-project/node_modules/@types/node/node_modules/undici-types
โ””โ”€ Version 5.26.5 from C:/code/my-project/node_modules/undici-types

```

่ดก็ŒฎๆŒ‡ๅ—

ๆ‰“ๅผ€่ดก็ŒฎๆŒ‡ๅ—

ไปŽ่ฟ™้‡Œๅผ€ๅง‹

  1. ๅ…ˆ่ฏปๅฎŒๆ•ดไธช Issue๏ผŒๅ†่ฏป้กน็›ฎ็š„่ดก็ŒฎๆŒ‡ๅ—ใ€‚
  2. ๅœจ Issue ไธ‹็•™่จ€่ฏดๆ˜Žไฝ ่ฆๆŽฅๆ‰‹ โ€”โ€” ่ฟ™่ƒฝ้ฟๅ…ไธคไธชไบบๅšๅŒๆ ท็š„ไบ‹ใ€‚
  3. Fork ไป“ๅบ“๏ผŒๅœจไธ€ไธชๅˆ†ๆ”ฏไธŠๅฎŒๆˆไฟฎๆ”นใ€‚
  4. ๆไบค Pull Request๏ผŒๅนถๅœจๆ่ฟฐ้‡Œๅผ•็”จ่ฟ™ไธช Issue ็ผ–ๅทใ€‚

่ฐƒ็ ”ๆ–นๅ‘

Reproduce the delay in the reported config.ts scenario with VS Code, TypeScript 5.9.2, and the Valibot declarations, then inspect the supplied typescript-analyze-trace output. Focus first on the reported checks involving OptionalSchema, ObjectSchema, and ExactOptionalSchema; done means identifying a TypeScript-side improvement and demonstrating faster prompting with a regression case.

็”ฑ็ดขๅผ•ๆจกๅž‹ๆ นๆฎ Issue ๅ†…ๅฎน็”Ÿๆˆใ€‚

่ฏ„ไผฐ

ๆŠ€ๆœฏๆ ˆ
typescript
้ข†ๅŸŸ
compilers, developer-experience
Issue ็ฑปๅž‹
็ผบ้™ท
้šพๅบฆ
4/5
้ข„่ฎก่€—ๆ—ถ
3-5 ๅคฉ
ๆดป่ทƒๅบฆ
ๅœๆปž
ๆ่ฟฐๆธ…ๆ™ฐๅบฆ
้œ€่ฆๆพ„ๆธ…
ๆ–ฐๆ‰‹ๅ‹ๅฅฝๅบฆ
28/100

ๆŠŠๆ–ฐ issue ๅ‘ๅˆฐไฝ ็š„้‚ฎ็ฎฑ

็ฒพ้€‰้€‚ๅˆๆ–ฐๆ‰‹ๅ‚ไธŽ็š„ GitHub issue ๆ‘˜่ฆใ€‚