7.1 regression: circular type alias accepts an assignment it should reject (opposite of #64891)
I maintainer di solito rispondono entro 1 giorno
@jasleenkaur-qed42 ci sta già lavorando.
Dal 23/10/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go, typescript
- Ambito
- compilers
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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!
- Lingua principale
- Go
- Stelle
- 112k
- Fork
- 15.4k
- Merge medio
- 2g 21h
- PR unite (30g)
- 126
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/TypeScript
-
Won't Fix
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
microsoft/TypeScript#65107 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationForse già presa @timurzvural l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/TypeScript#65087 ·
I maintainer di solito rispondono entro 1 giorno
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. ApertaBug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/TypeScript#64758 ·
I maintainer di solito rispondono entro 1 giorno
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`Forse già presa @rajnish-verma-22172 l’ha presa 12 giorni fa. ApertaBug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microsoft/TypeScript#64742 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsForse già presa @dmety l’ha presa 26 giorni fa. ApertaBug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/TypeScript#64661 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/TypeScript
Issue simili
-
[BUG] serviceenvupdater filter does not update KUBERNETES_SERVICE_HOST/PORT in init containersForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openyurtio/openyurt#2845 ·
I maintainer di solito rispondono entro 7 giorni
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
fix(scan): validate and normalize output format in validate-contractForse già presa @WKr1shna l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100