From 26129a5934f53bca568ef5eb28929871a17d20e1 Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 8 Dec 2023 23:36:01 +0100 Subject: [PATCH] feat: helpful TypeError message --- src/WebComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebComponent.js b/src/WebComponent.js index 4b1ae6f..52f9dfd 100644 --- a/src/WebComponent.js +++ b/src/WebComponent.js @@ -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));