Skip to content

Commit

Permalink
fix: set empty methods to propTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jun 29, 2018
1 parent 42607ae commit 1dbbdd0
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions packages/nerv/src/prop-types.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
import { noop } from 'nerv-shared'
const shim = noop as any
shim.isRequired = noop

export const PropTypes = {
array: noop,
bool: noop,
func: noop,
number: noop,
object: noop,
string: noop,
function getShim () {
return shim
}

const PropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,

any: noop,
arrayOf: noop,
element: noop,
instanceOf: noop,
node: noop,
objectOf: noop,
oneOf: noop,
oneOfType: noop,
shape: noop
any: shim,
arrayOf: getShim,
element: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
PropTypes: {},
checkPropTypes: noop
}

PropTypes.PropTypes = PropTypes

export { PropTypes }

0 comments on commit 1dbbdd0

Please sign in to comment.