Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ljharb/prop-types-exact
For use with React PropTypes. Will error on any prop not explicitly specified.
https://github.com/ljharb/prop-types-exact
Last synced: about 1 month ago
JSON representation
For use with React PropTypes. Will error on any prop not explicitly specified.
- Host: GitHub
- URL: https://github.com/ljharb/prop-types-exact
- Owner: ljharb
- License: mit
- Created: 2017-06-04T22:54:03.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-05-23T02:16:22.000Z (4 months ago)
- Last Synced: 2024-06-11T17:36:35.835Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 118 KB
- Stars: 237
- Watchers: 29
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# prop-types-exact [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url][![npm badge][npm-badge-png]][package-url]
For use with React PropTypes. Will error on any prop not explicitly specified.
## Usage
```jsx
import PropTypes from 'prop-types';
import exact from 'prop-types-exact';function Foo({ foo, bar }) {
return{foo}{bar}
}
Foo.propTypes = exact({
foo: PropTypes.string,
bar: PropTypes.number,
});// no warnings
// propTypes warning!
```## Tests
Simply clone the repo, `npm install`, and run `npm test`[package-url]: https://npmjs.org/package/prop-types-exact
[npm-version-svg]: http://versionbadg.es/ljharb/prop-types-exact.svg
[deps-svg]: https://david-dm.org/ljharb/prop-types-exact.svg
[deps-url]: https://david-dm.org/ljharb/prop-types-exact
[dev-deps-svg]: https://david-dm.org/ljharb/prop-types-exact/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/prop-types-exact#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/prop-types-exact.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/prop-types-exact.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/prop-types-exact.svg
[downloads-url]: http://npm-stat.com/charts.html?package=prop-types-exact
[codecov-image]: https://codecov.io/gh/ljharb/prop-types-exact/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/prop-types-exact/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/prop-types-exact
[actions-url]: https://github.com/ljharb/prop-types-exact/actions