7.1 regression: circular type alias accepts an assignment it should reject (opposite of #64891)
Les mainteneurs répondent en général sous 1 jour
@jasleenkaur-qed42 y travaille déjà.
Depuis le 23/10/2026.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- go, typescript
- Domaine
- compilers
Piste de recherche
Start by running the supplied TypeScript repro with strict mode and compare its result across the noted compiler versions; the report identifies commit microsoft/typescript-go#4820 and a related case in #64891. Trace how circular aliases with two type parameters are checked, including the reported declaration-order and check-order effects. Done when the repro reports TS2322 and the related case still behaves as expected.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Search Terms
circular type alias variance, missing TS2322, unrelated type arguments assignable, 7.1 regression, #64891
Version & Regression Information
- This changed between versions 7.0.2 and 7.1.0-dev.20261022.1
- This changed in commit or PR microsoft/typescript-go#4820
I bisected it with the nightlies: 7.1.0-dev.20260805.1 (built from 12318e599) reports the error, and 7.1.0-dev.20260806.1 (built from 86cc4767d, the #4820 merge) doesn't.
Playground Link
No response
Code
type Params<T, K> = { config: Config<T, K> };
type Handler<T, K> = (params: Params<T, K>) => void;
type Config<T, K> = { read: (item: T) => void; handler: Handler<T, K> };
declare const a: Handler<string, string>;
export const b: Handler<number, string> = a; // should be TS2322
{ "compilerOptions": { "strict": true, "noEmit": true, "types": [] }, "files": ["a.ts"] }
Actual behavior
No errors. A handler that reads strings is accepted where one that reads numbers is expected.
It's not just close types either: Handler<boolean, { x: 1 }> is accepted too.
Expected behavior
TS2322 on the last line, same as 6.0.3 and 7.0.2.
Additional information about the issue
Hi there!
Some context on how I found this: I've been testing out the latest 7.1 nightlies and I'm super excited about them, mainly for the memory and CPU speedups. We have a very large TypeScript monorepo in production, so those gains make a real difference for us.
While digging into #64891 I found the opposite case, and I think it's the other half of the same bug. That issue is about 7.1 rejecting code it should accept. This one is the opposite, it accepts code it should reject, which is a bit scarier because nothing tells you it happened.
Here's what I see with tsc -p . (same result on every run):
| Build | This repro | #64891 repro |
|---|---|---|
| 6.0.3 | TS2322 (correct) | no errors (correct) |
| 7.0.2 | TS2322 (correct) | no errors (correct) |
| 7.1.0-dev.20261022.1 | no errors (wrong) | TS2322 (wrong) |
| #64893 (6e72aa76c, built locally) | TS2322 (correct) | no errors (correct) |
A few other things I noticed while narrowing it down:
-
It needs two type parameters. With only
T, every build reports the error. -
If I move
HandleraboveParams, the nightly reports the error again. -
#64893 fixes both repros, but the result still depends on what gets checked first. If
Paramsis compared beforeHandler, every build I tried misses theHandlererror, #64893 included:declare const p: Params<string, string>; export const q: Params<number, string> = p; // TS2322 everywhere declare const a: Handler<string, string>; export const b: Handler<number, string> = a; // missed everywhereSo I'm not sure #64893 is the full fix, but it does get things back to how 7.0.2 behaves.
Thanks for all the work on 7.x, it's been great so far!
- Langage dominant
- Go
- Étoiles
- 112k
- Forks
- 15.4k
- Merge moyen
- 3 j 6 h
- PR mergées (30 j)
- 136
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/TypeScript
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoft/TypeScript#65087 ·
Les mainteneurs répondent en général sous 1 jour
-
API: `tsc.exe` opens a visible console window on Windows when the parent process has no consoleOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoft/TypeScript#65083 ·
Les mainteneurs répondent en général sous 1 jour
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'Peut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
microsoft/TypeScript#64758 ·
Les mainteneurs répondent en général sous 1 jour
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`Peut-être pris @rajnish-verma-22172 l’a pris il y a 12 jours. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
microsoft/TypeScript#64742 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsPeut-être pris @dmety l’a pris il y a 25 jours. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
microsoft/TypeScript#64661 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de microsoft/TypeScript
Issues similaires
-
date_time, url_encode, html_escape, to_unix_time, contains_all and contains_any panic when called without argumentsPeut-être pris @antcybersec l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
projectdiscovery/dsl#372 ·
Les mainteneurs répondent en général sous 1 jour
-
blocked-needs-validation
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
projectcapsule/capsule#2265 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
JuliusBrussee/caveman#1449 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
bot-found bug priority: P3
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
madenvel/KalinkaPlayer#498 ·