Simple type-checking in dev-mode

Displays the warning in console if the type of the new value of data property isn't equal to previous. Important in development when interfaces of components are still too fluid.
pull/1725/head
PaulMaly 7 years ago committed by GitHub
parent a4d412fb53
commit 5a98aa545b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -140,6 +140,14 @@ export function setDev(newState) {
}
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