microsoft / microsoft/TypeScript

Design Meeting Notes, 2026-09-15

Ouverte
#64,290 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Design Notes
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
2 j 4 h
PR mergées (30 j)
132

Description

# Better Type Inference Self-Referential Values

- https://github.com/microsoft/TypeScript/issues/64192
- https://github.com/microsoft/TypeScript/issues/62180
- https://github.com/microsoft/TypeScript/issues/62181
- https://github.com/microsoft/TypeScript/pull/64172
- https://github.com/microsoft/TypeScript/pull/64248

```ts
const Category = z.object({
get subcategories() {
// ~~~~~~~~~~~~~
// Subcategory implicitly has type 'any' because of circular
// resolution.
return z.array(Category);
}
});
```

* Zod and similar libraries are motivation here.
* While processing the object literal, we normally defer return types for `get` accessors.
* But when validating the constraint, we start pulling on those very types.
* One idea: when we try to resolve a call that is already undergoing resolution, we say "don't check constraints".
* Why don't we disable constraint checking for all calls and do it in another pass?
* We're not always interested in just generating an error, we're often trying to grab the constraint for other information (e.g. if there's no candidates, we have to fix to the constraint).
* How does this affect overloads? Because this would affect how we choose overloads, right?
* Should not play in?
* Could we just return the original *uninstantiated* type parameter from the call when you detect this circularity?
* How would that work? Isn't that a type parameter leak?
* Yes, but the idea is there's an "outer" call and an "inner" call. The inner call would leak a type parameter (e.g. `T`) and the outer call would instantiate it after inference.
* Scary, but maybe!
* Outstanding PRs are likely not quite what we're looking for, but may have a PR prototyping these ideas soon.

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 lire les issues liées 64192, 62180 et 62181, puis examinez les PRs 64172 et 64248 pour étudier les approches existantes. Les notes présentent plusieurs conceptions non résolues concernant l’inférence de types circulaire, les overloads, les constraints et la fuite des paramètres de type, mais n’identifient ni fichiers, ni tests, ni critère d’achèvement.

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

Évaluation

Stack technique
typescript
Domaine
compilers
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Active
Clarté
À clarifier
Accessibilité débutants
20/100

Recevez les nouvelles issues par e-mail

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