Skip to content

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

@geon

Description

@geon

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("");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions