Skip to content

complete/type-declaration-immutability

💼 This rule is enabled in the ✅ recommended config.

📝 Enforces that interfaces are immutable.

💭 This rule requires type information.

This rule has the same purpose as functional/type-declaration-immutability, but has no options and requires every interface to be fully immutable. Type aliases are not checked, and interface names do not affect enforcement.

// Bad
interface Foo {
bar: string;
}
// Good
interface Foo {
readonly bar: string;
}

Deeply immutable ReadonlyMap, ReadonlySet, and read-only array types are considered immutable.

This rule is not configurable.