Problem Statement
Typing this in methods uses…
Explanation
You can add a fake first parameter named `this` to type the `this` context. It isn’t emitted at runtime—it’s only for type checking.
Code Solution
SolutionRead Only
function move(this: { x: number; y: number }, dx: number, dy: number){
this.x += dx; this.y += dy;
}
const p = { x: 0, y: 0, move };
p.move(1,2);