prop-types-exact

1.2.0 • Public • Published

prop-types-exact Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

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

Usage

import PropTypes from 'prop-types';
import exact from 'prop-types-exact';
 
function Foo({ foo, bar }) {
  return <div>{foo}{bar}</div>
}
Foo.propTypes = exact({
  foo: PropTypes.string,
  bar: PropTypes.number,
});
 
<Foo foo="hi" bar={3} /> // no warnings
 
<Foo foo="hi" bar={3} baz="extra" /> // propTypes warning!

Tests

Simply clone the repo, npm install, and run npm test

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.0
    2,904,188
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.0
    2,904,188
  • 1.1.2
    12,433
  • 1.1.1
    4,655
  • 1.1.0
    2
  • 1.0.0
    2

Package Sidebar

Install

npm i prop-types-exact

Weekly Downloads

1,425,354

Version

1.2.0

License

MIT

Unpacked Size

24.1 kB

Total Files

25

Last publish

Collaborators

  • brieb
  • airbnbeng
  • lencioni
  • ljharb