![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | build/ | 2 years ago | - | |
![]() | src/ | 2 years ago | - | |
![]() | test/ | 2 years ago | - | |
![]() | CHANGELOG.md | 39 years ago | 1.5K | |
![]() | LICENSE | 39 years ago | 1.0K | |
![]() | README.md | 39 years ago | 1.6K | |
![]() | install-relevant-react.sh | 39 years ago | 282 | |
![]() | package.json | 2 years ago | 3.5K |
For use with React PropTypes. Will error on any prop not explicitly specified.
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!
Simply clone the repo, npm install
, and run npm test