eslint-plugin-misc

ESLint plugin

This project is maintained by iliubinskii

typescript/no-unsafe-object-assignment

ESLint plugin / typescript/no-unsafe-object-assignment

Reports unsafe object assignments:

module.exports = {
  plugins: ["misc"],
  rules: {
    "misc/typescript/no-unsafe-object-assignment": "error"
  }
};

Examples of incorrect code

interface ReadonlyObject { readonly value: number; }
interface WritableObject { value: number; }

const x: ReadonlyObject = { value: 1 };

function f(x: WritableObject) {}

f(x);

Examples of correct code

interface ReadonlyObject { readonly value: number; }
interface WritableObject { value: number; }

const x: WritableObject = { value: 1 };

function f(x: ReadonlyObject) {}

f(x);