Skip to content
For use with React PropTypes. Will error on any prop not explicitly specified.
JavaScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src [New] add `sloppy` import, for removing the "exact"ness on a propType… Jun 15, 2018
test [New] add `sloppy` import, for removing the "exact"ness on a propType… Jun 15, 2018
.babelrc [Dev Deps] update `babel-plugin-istanbul`, `babel-plugin-transform-re… Jun 15, 2018
.eslintignore
.eslintrc [Fix] replace the object semaphore with a global Symbol/string. Jan 17, 2018
.gitignore [Tests] ignore istanbul output Jun 5, 2017
.npmignore [Tests] ignore istanbul output Jun 5, 2017
.npmrc
.nycrc [Tests] nyc include all files Jun 5, 2017
.travis.yml [Tests] require 0.12 and 0.10 to pass, thanks to nathanhleung/install… Jun 18, 2018
CHANGELOG.md v1.2.0 Jun 15, 2018
LICENSE
README.md [Docs] add readme Jun 5, 2017
package.json

README.md

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

You can’t perform that action at this time.