prop-types-exact
For use with React PropTypes. Will error on any prop not explicitly specified.
Last updated 8 years ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install prop-types-exact 
SYNC missed versions from official npm registry.

prop-types-exact Version Badge

github actions coverage 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

Current Tags

  • 1.2.4                                ...           latest (7 months ago)

9 Versions

  • 1.2.4                                ...           7 months ago
  • 1.2.3                                ...           7 months ago
  • 1.2.2                                ...           7 months ago
  • 1.2.1                                ...           7 months ago
  • 1.2.0                                ...           7 years ago
  • 1.1.2                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (2)
Downloads
Total 8
Today 0
This Week 0
This Month 8
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (19)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE