bind is called on an arrow function, whose this cannot change
What it finds
(() => this.render()).bind(this): an arrow function takes this from where it is written, and bind cannot change it, so binding one only makes a copy.
The fix drops .bind(...) when its only argument is the this value, read without effects; it is safe. With more arguments, which bind would fix in place, there is no fix.
From the rule's source, arrow_bind.rs.
class View { name = "v"; handlers() { const a = (() => this.name).bind(this);tx0 reports: binding an arrow function does not change its this const b = ((x: number) => x + 1).bind(null, 1);tx0 reports: binding an arrow function does not change its this const c = function (this: View) { return this.name; }.bind(this); return [a, b, c]; }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:arrow-bind" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:arrow-bind] reason="..."tx0 explain tx0/ts:arrow-bind shows the same in the terminal. Found a false positive? Report it.