Skip to content

[no-unsafe-assignment] doesn't handle interface implementation #40

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

Closed
danielnixon opened this issue Aug 7, 2020 · 2 comments
Closed
Labels
good first issue Good for newcomers

Comments

@danielnixon
Copy link
Owner

From microsoft/TypeScript#18770 (comment)

type I = {
  readonly a: string;
};

// eslint-disable-next-line functional/no-class
class C implements I {
  // This should be flagged by no-unsafe-assignment or another (new) rule
  // eslint-disable-next-line functional/prefer-readonly-type
  a = "";
}

const D = new C();

// eslint-disable-next-line functional/no-expression-statement, functional/immutable-data
D.a = "something";
@danielnixon danielnixon added the good first issue Good for newcomers label Aug 7, 2020
@danielnixon
Copy link
Owner Author

Similarly:

interface Shape {
  readonly color: string;
}

interface Square extends Shape {
  color: string;
}

@danielnixon
Copy link
Owner Author

And:

type Shape = {
  readonly color: string;
};

type Square = Shape & {
  // eslint-disable-next-line functional/prefer-readonly-type
  color: string;
};

danielnixon added a commit that referenced this issue Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant