Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prop-types-exact

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prop-types-exact

For use with React PropTypes. Will error on any prop not explicitly specified.

  • 1.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
increased by14.76%
Maintainers
2
Weekly downloads
 
Created

What is prop-types-exact?

The prop-types-exact npm package is used to enforce that no additional (undeclared) props are passed to a React component than the ones specified in the propTypes object. This is useful for catching typos or unwanted extra props that might be passed to a component due to refactoring or changes in the codebase.

What are prop-types-exact's main functionalities?

Enforcing exact prop types

This code sample demonstrates how to use prop-types-exact to ensure that the MyComponent only receives the props 'name' and 'age', and no additional props. If any extra props are passed, a warning will be shown in the console during development.

{"MyComponent.propTypes = PropTypesExact({ name: PropTypes.string, age: PropTypes.number }); MyComponent.defaultProps = { name: 'John Doe', age: 30 };"}

Other packages similar to prop-types-exact

Keywords

FAQs

Package last updated on 11 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc