You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7fce912
Browse filesBrowse the repository at this point in the historyBrowse files
fix(eslint-plugin): [unbound-method] respect this: void on class properties
A class property initialized with a function expression was the only
literal-function case that skipped `checkMethod`, so its own `this: void`
annotation was ignored:
```ts
const Foo = { floor: function (this: void) {} };
const { floor } = Foo; // correctly not reported
class Foo { floor = function (this: void) {} }
const { floor } = new Foo(); // reported, despite `this: void`
```
Routing it through `checkMethod` fixes that, and makes the two property
cases identical enough to share a branch. `ts.isFunctionExpression`
narrows the initializer for real, so the cast the old `.kind` check
needed goes away.
Skipping `checkMethod` also meant `firstParamIsThis` went uncomputed, so
these reports never carried the message that suggests annotating with
`this: void`. They do now, which moves 19 expectations - and leaves the
plain `unbound` message covered only by a new case whose function
expression annotates a non-`void` `this`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments