prop-types-exact ![Version Badge](https://camo.githubusercontent.com/282acd66c827211badc9577414d81a687aa7653c828150d9195d38c728309dec/687474703a2f2f76657273696f6e626164672e65732f616972626e622f70726f702d74797065732d65786163742e737667)
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