microsoft / microsoft/TypeScript

Crash: when inferring from a tuple with middle rest elements and trailing variadic elements

Ouverte
#63,005 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Bug Domain: Crashes Help Wanted
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
2 j 4 h
PR mergées (30 j)
132

Description

### 🔎 Search Terms

Internal Error: Debug Failure

Variadic tuple types crash

infer rest elements crash

tuple mapping crash

### 🕗 Version & Regression Information

Versions tested: 5.7.3, 5.8.3, 5.9.3, Nightly

### ⏯ Playground Link

https://www.typescriptlang.org/zh/play/?target=7&noEmit=true&ts=6.0.0-dev.20260117#code/PTAEAEGcBcCcEsDG0Bco4FcCmAoEEA7AewFEBbeVdWbPMWLAB1iNAGIBWARi4GYAOHNACejLKADKGAEYAVDIwBMAJSwwAggQAms2AEN4AG3gEA5gDU9CPVqSKAPLNBYAHtCzbIoDAQDWxAHcCAG0AXQA+UABeUCdXd09QYJxQVNAAOkyAChMAMyxYUABhAEowgBoUtMz0vILQACFnNw8tL2C9AmFyzu7EfUgAC1CcUNAq1IB+JKLymoaxidA0AiwANwKAbhwhUXEpOQUVNWhNHX0jEwsreBs7WRPoyRl5JVUNbV0DYzNLa1tEA5gjU9GgAAwVaRoLjlRBoRQRbZAA

### 💻 Code

```ts
// repro #51138
type SubTup2RestAndTrailingVariadic2 = T extends [
...(infer C)[],
...infer B extends [any,any,crash]
]
? [C,...B]
: never;

type SubTup2RestAndTrailingVariadic2Test = SubTup2RestAndTrailingVariadic2<[...a: 0[],b: 1,c: 2]>;

```

### 🙁 Actual behavior

```
.\ts-versions\nightly\node_modules\.bin\tsc.cmd .\inferTypesWithFixedTupleExtendsAtVariadicPosition_m.ts
D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:123178
throw e;
^

TypeError: Cannot read properties of undefined (reading 'aliasSymbol')
at inferFromTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68512:18)
at inferFromObjectTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68994:21)
at invokeOnce (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68704:9)
at inferFromTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68666:11)
at inferTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68500:5)
at getConditionalType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:62537:11)
at getConditionalTypeInstantiation (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63526:305)
at instantiateTypeWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63629:14)
at instantiateTypeWithAlias (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63566:20)
at getTypeAliasInstantiation (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:60132:52)

Node.js v22.19.0
```

### 🙂 Expected behavior

The compiler should report a syntax error and not crash.

### Additional information about the issue

_No response_

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire le problème dans Playground et avec l’exemple d’inférence de tuple fourni, puis suivez la pile du compilateur de inferFromTypes à inferFromObjectTypes, puis à getConditionalType. Reproduisez le plantage avec les versions de TypeScript indiquées et identifiez l’emplacement pertinent du test de régression du compilateur. C’est terminé lorsque cette entrée signale une erreur de syntaxe au lieu de lever un TypeError interne.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
compilers
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.