Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"readonly-array": [true, "ignore-local"] should not affect interface definitions #87

Open
geon opened this issue Aug 1, 2018 · 0 comments

Comments

@geon
Copy link
Contributor

geon commented Aug 1, 2018

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("");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant