feat: simpler TypeError; use proxy default err

This commit is contained in:
Ayo 2023-12-08 23:14:03 +01:00
parent 75f914606f
commit 07bb2d850a
2 changed files with 2 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "web-component-base", "name": "web-component-base",
"version": "2.0.0-beta.10", "version": "2.0.0-beta.11",
"description": "A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily", "description": "A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily",
"type": "module", "type": "module",
"exports": { "exports": {

View file

@ -134,9 +134,7 @@ export class WebComponent extends HTMLElement {
effectsMap[prop] = []; effectsMap[prop] = [];
} }
effectsMap[prop].push(value.callback); effectsMap[prop].push(value.callback);
} else if (typeof oldValue !== typeof value) { } else if (typeMap[prop] !== typeof value) {
const err = new TypeError(`[${meta.constructor.name}.props.${prop}] ${typeof value} is not assignable to ${typeof oldValue}`)
console.error(err);
return false; return false;
} else if (oldValue !== value) { } else if (oldValue !== value) {
obj[prop] = value; obj[prop] = value;