Why is this an issue?

React components should treat their props as read-only. Declaring props with TypeScript’s Readonly utility type lets the type checker report direct assignments to those properties, helping prevent a child component from modifying data supplied by its parent.

Noncompliant code example

interface Props {
  name: string;
}

function Welcome(props: Props) { // Noncompliant: props are not read-only
  return <div>Hello {props.name}</div>;
}

Compliant solution

Use Readonly<Props> when the component should receive a read-only view of an existing type.

interface Props {
  name: string;
}

function Welcome(props: Readonly<Props>) {
  return <div>Hello {props.name}</div>;
}

Alternatively, mark every property in Props with the readonly modifier when the type should be read-only wherever it is used:

interface Props {
  readonly name: string;
}

Both approaches are shallow: a nested object’s properties remain writable unless their types are also read-only. These annotations do not freeze objects at runtime or, by themselves, prevent React re-renders. Updates should still flow from the component that owns the data, for example through a callback passed as a prop.

Resources

Documentation