All Projects → airbnb → Prop Types Exact

airbnb / Prop Types Exact

Licence: mit
For use with React PropTypes. Will error on any prop not explicitly specified.

Programming Languages

javascript
184084 projects - #8 most used programming language

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].