prop-types-extra is a utility library designed to augment React's prop-validation capabilities by providing an extended set of PropTypes. It builds upon the foundational `prop-types` package, offering specialized validators that address common and complex validation scenarios in React component development. Key validators include `all`, which enables combining multiple validation rules; `componentOrElement`, for validating props expecting either a React component or a DOM element reference; `deprecated`, a utility to log deprecation warnings for specific props; `elementType`, for ensuring a prop is a valid React element type (e.g., a string for a DOM element or a component constructor); and `isRequiredForA11y`, which enforces accessibility requirements. The package is currently at version 1.1.1. As a supplementary tool for `prop-types`, its release cadence is typically stable, with updates driven primarily by React's evolution or specific bug fixes rather than frequent feature additions. It differentiates itself by providing ready-to-use, advanced validation patterns, thereby simplifying the creation of robust and semantically correct React components.
Verified import paths — ran on the pinned version, not inferred.
Preferred for general use. The CommonJS `require` syntax is less modern and may not be supported in all build environments.
Use this direct path import to cherry-pick individual validators and optimize bundle size. Importing a named export from the `lib/` path is incorrect.
Standard named import for the `all` validator. The CommonJS `require` syntax is less modern.
Standard named import for the `deprecated` validator. Direct path import is `import deprecated from 'prop-types-extra/lib/deprecated';`.
Demonstrates the use of the `all` validator to combine standard PropTypes with a custom semantic validation function, showing how to enforce conditional prop dependencies for robust component usage.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.