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

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

Current Tags

  • 1.2.0                                ...           latest (2 years ago)

5 Versions

  • 1.2.0                                ...           2 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Downloads
Today 574
This Week 13,387
This Month 14,764
Last Day 2,397
Last Week 16,148
Last Month 65,543
Dependencies (3)
Dev Dependencies (17)

Copyright 2014 - 2016 © taobao.org |