microsoft / microsoft/TypeScript
`get self(): this` in an interface crashes the checker (6.0 regression)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
### 🔎 Search Terms
getConditionalFlowTypeOfType, getAnnotatedAccessorType, Cannot read properties of undefined (reading 'flags'), accessor this type
### 🕗 Version & Regression Information
- Crashes in 6.0.3 and nightly (6.0.0-dev.20260416); 5.9.3 is clean — a 6.0 regression
### 💻 Code
```ts
interface I {
get self(): this
}
```
### 🙁 Actual behavior
`tsc` crashes:
```
TypeError: Cannot read properties of undefined (reading 'flags')
at getConditionalFlowTypeOfType (typescript/lib/_tsc.js:65892:23)
at getTypeFromTypeNode (typescript/lib/_tsc.js:68622:12)
at getAnnotatedAccessorType (typescript/lib/_tsc.js:62162:20)
at getTypeOfAccessors (typescript/lib/_tsc.js:62180:99)
at checkAccessorDeclarationDiagnostics (typescript/lib/_tsc.js:87089:26)
```
Any `this` nested inside the accessor's return type annotation triggers it too (`get pair(): [this, string]`). A method or property signature with the same `this` type is fine.
### 🙂 Expected behavior
No crash (5.9 checks this without errors).
### Additional information about the issue
_No response_
Guida per i contributori
Apri 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.
Direzione di ricerca
Riproduci il crash con lo snippet dell’interfaccia e i casi di accessor segnalati. Inizia da getAnnotatedAccessorType, getTypeOfAccessors e getConditionalFlowTypeOfType nello stack del checker segnalato, quindi individua i sorgenti TypeScript corrispondenti e la configurazione dei test di regressione. Il lavoro è completato quando questi accessor non causano più crash e il comportamento esistente della 5.9 rimane coperto da un test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 68/100