diff --git a/src/core/AnimatedAlways.js b/src/core/AnimatedAlways.js index ab95d9d..71f1d8d 100644 --- a/src/core/AnimatedAlways.js +++ b/src/core/AnimatedAlways.js @@ -1,14 +1,14 @@ import AnimatedNode from './AnimatedNode'; +import invariant from 'fbjs/lib/invariant'; export default class AnimatedAlways extends AnimatedNode { _what; constructor(what) { - if (!(what instanceof AnimatedNode)) { - throw new Error( - `Animated.always parameter should be of type AnimatedNode but got ${typeof what}` - ); - } + invariant( + what instanceof AnimatedNode, + `Animated.set target should be of type AnimatedNode but got ${typeof what}` + ); super({ type: 'always', what: what.__nodeID }, [what]); this._what = what; } diff --git a/src/core/AnimatedSet.js b/src/core/AnimatedSet.js index 79e9c97..d0ae1b3 100644 --- a/src/core/AnimatedSet.js +++ b/src/core/AnimatedSet.js @@ -1,16 +1,16 @@ import AnimatedNode from './AnimatedNode'; import { val } from '../utils'; +import invariant from 'fbjs/lib/invariant'; export default class AnimatedSet extends AnimatedNode { _what; _value; constructor(what, value) { - if (!(what instanceof AnimatedNode)) { - throw new Error( - `Animated.set target should be of type AnimatedNode but got ${typeof what}` - ); - } + invariant( + what instanceof AnimatedNode, + `Animated.set target should be of type AnimatedNode but got ${typeof what}` + ); super({ type: 'set', what: what.__nodeID, value: value.__nodeID }, [value]); this._what = what; this._value = value;