Menu
Important
Stay updated on React2Shell

NO_UNNECESSARY_PROP_SPREADING

Last updated March 4, 2025

Conformance is available on Enterprise plans

This rule is available from version 1.6.0.

This rule detects the usage of the spread operator when spreading an object as a prop within a JSX component.

When spreading an object in the component, the data types of the object's properties are not validated, potentially causing unexpected runtime errors or unintended behavior.

In the following example, the component contains an object with the spread operator being applied to it.

We don't know if the props that the component reads will accept all the values contained in the object.

You can remove the spread operator from the JSX component, and list all props explicitly.

In the example above, TypeScript will be able to type-check all props.


Was this helpful?

supported.