feat: helpful TypeError message

This commit is contained in:
Ayo 2023-12-08 23:36:01 +01:00
parent 07bb2d850a
commit 26129a5934

View file

@ -135,7 +135,7 @@ export class WebComponent extends HTMLElement {
}
effectsMap[prop].push(value.callback);
} else if (typeMap[prop] !== typeof value) {
return false;
throw TypeError(`Cannot assign ${typeof value} to ${typeMap[prop]} property (setting '${prop}' of ${meta.constructor.name})`)
} else if (oldValue !== value) {
obj[prop] = value;
effectsMap[prop]?.forEach((f) => f(value));