包详细信息

prop-types-exact

ljharb6.1mMIT1.2.7

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

react, propTypes, prop, types

自述文件

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

更新日志

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.2.7 - 2024-12-28

Commits

  • [Dev Deps] update eslint-plugin-react 2575471
  • [Refactor] use own-keys directly 556524b
  • [meta] add funding field 45152ae
  • [Deps] update object.assign 4d40857

v1.2.6 - 2024-12-16

Commits

  • [Dev Deps] update @babel/cli, auto-changelog, eslint-plugin-react, tape 16fdbca
  • [Refactor] use call-bound directly 00bda61
  • [Tests] replace aud with npm audit 9c3ce58
  • [Deps] update call-bind 67fda6f
  • [Dev Deps] pin psl due to breaking change in a minor version d1d049c
  • [Dev Deps] add missing peer dep f3f14fb

v1.2.5 - 2024-07-11

Fixed

  • [Fix] do not check non-enumerable props like key #19

Commits

  • [Dev Deps] update @babel/cli, eslint-plugin-react, tape 6c4bd8c

v1.2.4 - 2024-05-22

Commits

  • [Fix] un-inline isPlainObject 03be2c0

v1.2.3 - 2024-05-22

Fixed

  • [Fix] restore isPlainObject helper for airbnb-prop-types to use #18

v1.2.2 - 2024-05-22

Commits

  • [Refactor] avoid a build process on the implementation code 5a182fd
  • [Tests] run prebuilt tests 3a537d3
  • [eslint] config cleanup ce9ff59
  • [Tests] upgrade to babel 7 a546939
  • [Tests] always run coverage 31cc253
  • [readme] fix badges 3c108ac
  • [meta] add sideEffects flag 518b803
  • [Tests] skip pack tests c6e232d
  • [Tests] skip v0.8 29e674a
  • [Fix] in node < 1, . needs to be ./ 64e3fa4

v1.2.1 - 2024-05-22

Commits

  • [eslint] switch to tabs 123c070
  • [Tests] migrate from travis to github actions 1ac4d15
  • [Tests] use enzyme-adapter-react-helper 5b8dc0c
  • [Dev Deps] update enzyme-adapter-react-helper, eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, in-publish, prop-types, rimraf, safe-publish-latest, tape befc6c8
  • [meta] add auto-changelog cf7a309
  • [meta] update URLs 1c9142d
  • [meta] use npmignore 52bb049
  • [Tests] ignore node deprecation warnings af8ca11
  • [Tests] add aud in posttest 0f8202c
  • [Refactor] use hasown instead of has b1b43b6
  • [Dev Deps] update eslint, eslint-plugin-react, tape 230785f
  • [Refactor] use assignment instead of Object.assign for a single property c837a69
  • [Tests] clean up some scripts fc77d6f
  • [Robustness] use isarray a50846d
  • [Deps] update hasown, reflect.ownkeys a97e67d
  • [Deps] update has, object.assign, reflect.ownkeys 96e27ef
  • [meta] move the build step to prepack f556234
  • [meta] add missing engines.node daf1508
  • [Robustness] use es-errors for TypeError 0137c8d
  • [Tests] require 0.12 and 0.10 to pass, thanks to https://github.com/nathanhleung/install-peerdeps/pull/29 84bcbd1
  • [Dev Deps] add babel-register eb8bfd8

1.2.0 / 2018-06-14

  • [New] add sloppy import, for removing the "exact"ness on a propTypes object
  • [Deps] update has
  • [Dev Deps] update babel-plugin-istanbul, babel-plugin-transform-replace-object-assign, eslint, eslint-plugin-import, eslint-plugin-react, nyc, prop-types
  • [Tests] on node v10
  • [Tests] switch from mocha to tape, since mocha drops support for older nodes
  • [Tests] on react 16
  • [Tests] fix test scripts

1.1.2 / 2018-01-17

  • [Fix] replace the object semaphore with a global Symbol/string
  • [Deps] update object.assign
  • [Dev Deps] update babel-cli, babel-plugin-istanbul, babel-preset-airbnb, chai, eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, mocha, nyc, prop-types, rimraf; downgrade mocha to v3
  • [Tests] on node v9; use nvm install-latest-npm

1.1.1 / 2017-07-06

  • [Fix] no longer use a Symbol; React doesn’t check those (#3)
  • [Tests] fix tests to fail properly (#3)

1.1.0 / 2017-06-05

  • [New] use a Symbol instead of a zero-width space when supported (#2)
  • [Fix] correct the error message when a conflict is found
  • [Dev Deps] update chai
  • [Tests] [Refactor] dynamically determine the special property instead of hardcoding the zero width space.
  • [Tests] ignore istanbul output
  • [Tests] nyc include all files

1.0.0 / 2017-06-04

  • Initial release.