# Limit Property Setters

Prefer explicit set/get functions (e.g. `setBar` and `getBar` functions) over setters/getters.

Consider the following code:

```typescript
foo.bar = {
    a: 123,
    b: 456
};
```

In the presence of setter/getters:

```typescript
class Foo {
    a: number;
    b: number;
    set bar(value:{a:number,b:number}) {
        this.a = value.a;
        this.b = value.b;
    }
}
let foo = new Foo();
```

This is not a _good_ use of property setters. The person reading the first code sample has no context about all the things that will change. Whereas someone calling `foo.setBar(value)` might have an idea that something might change on `foo`.

> Bonus points: Find references works better if you have different functions. In TypeScript tools if you find references for a getter or a setter you get _both_ whereas with explicit function calls you only get references to the relevant function.
