microsoft / microsoft/TypeScript
`get self(): this` in an interface crashes the checker (6.0 regression)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
🔎 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
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Absturz mit dem Interface-Snippet und den gemeldeten Accessor-Fällen. Beginne bei getAnnotatedAccessorType, getTypeOfAccessors und getConditionalFlowTypeOfType im gemeldeten Checker-Stack und finde dann die entsprechenden TypeScript-Quellen und das Setup für Regressionstests. Erledigt ist die Aufgabe, wenn diese Accessors nicht mehr abstürzen und das bestehende Verhalten von 5.9 weiterhin durch einen Test abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 68/100