Merge pull request #1 from PaulMaly/check-type-in-dev

Simple type-checking in dev-mode
pull/1724/head
PaulMaly 7 years ago committed by GitHub
commit 4b641ab202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -138,8 +138,16 @@ export function setDev(newState) {
this._debugName + '.set was called without an object of data key-values to update.'
);
}
this._checkReadOnly(newState);
Object.keys(newState).forEach(prop => {
if (prop in this._state && typeof this._state[prop] !== 'undefined'
&& typeof this._state[prop] !== typeof newState[prop]) {
console.warn('Type of data property "' + prop + '" not match with previous one.');
}
});
set.call(this, newState);
}

Loading…
Cancel
Save