microsoft / microsoft/TypeScript

`get self(): this` in an interface crashes the checker (6.0 regression)

Open
#63,619 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Fixed
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

### 🔎 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_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the interface snippet and the reported accessor cases. Start at getAnnotatedAccessorType, getTypeOfAccessors, and getConditionalFlowTypeOfType in the reported checker stack, then locate the corresponding TypeScript sources and regression-test setup. Done means these accessors no longer crash and the existing 5.9 behavior remains covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.