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

Mutable prefix for indexer interfaces #75

Open
jonaskello opened this issue Feb 20, 2018 · 1 comment
Open

Mutable prefix for indexer interfaces #75

jonaskello opened this issue Feb 20, 2018 · 1 comment

Comments

@jonaskello
Copy link
Owner

There is an escape hatch for mutable members of an interface by prefixing them. However this is not useful for indexer interfaces. So I propose to extend the prefix to apply to the interface name too. If the interface name starts with something that is in the ignore-prefix option then ignore it. This would mean that with this config:

"readonly-keyword": [true, {"ignore-prefix": "Mutable"}]

No member of this interface would not be checked:

interface MutableFoo {
  [key: string]: string;
  bar: number
}
@jonaskello
Copy link
Owner Author

Another idea would be to check the name of the indexer key for the prefix:

interface MutableFoo {
  [mutableKey: string]: string; // This is ok because the key is prefixed with mutable
  bar: number // This will give an error as there is no mutable prefix
}

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