tslint-immutable
tslint-immutable copied to clipboard
`"readonly-array": [true, "ignore-local"]` should not affect interface definitions
The point of "ignore-local" is that you still have a pure function, even if you have local state. But in readonly-array, even local interface definitions are ignored, even if they will be exposed by returning them.
Example:
function foo () {
interface Foo {
foo: Array<string>
}
const bar: Foo = {
foo: []
};
// bar.foo is mutable here, which makes sense.
bar.foo.push("");
return bar;
}
const oops = foo();
// ...but it is also mutable here, which is dangerous.
oops.foo.push("");