← All recipes
Moderne licensed

Remove propTypes that no longer check anything

Recipe IDorg.openrewrite.node.migrate.prop-types.remove-prop-typesArtifact@openrewrite/recipes-nodejs

Removes Component.propTypes = {...} assignments and static propTypes class members where they have become redundant, then the prop-types import and, once no source uses it, the prop-types dependency. In TypeScript a component's propTypes are removed when its props are already typed (an annotated props parameter, React.FC<Props>, type arguments on forwardRef/memo, or Component<Props>). In JavaScript they are removed where the package runs React 19 or later, which ignores propTypes entirely, unless a documentation tool (Storybook, react-docgen, Styleguidist, Docz) builds prop tables from them. Packages whose peerDependencies still admit React before 19 keep them, as do components whose propTypes are read elsewhere (spread into another component's, or passed to checkPropTypes). Lock files are not regenerated; run the package manager's install afterwards.

Single recipeprop-typesreactProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.node.migrate.prop-types.remove-prop-types

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/recipes-nodejs