From bea93f69f76793224672c4b0fdfa85b0fd15180c Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 8 Dec 2023 22:40:03 +0100 Subject: [PATCH] feat: improve error report for type mismatch --- src/WebComponent.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/WebComponent.js b/src/WebComponent.js index 650820e..dfb6392 100644 --- a/src/WebComponent.js +++ b/src/WebComponent.js @@ -135,7 +135,9 @@ export class WebComponent extends HTMLElement { } effectsMap[prop].push(value.callback); } else if (typeof oldValue !== typeof value) { - throw new TypeError(`[${meta.constructor.name}.props.${prop}] ${typeof value} is not assignable to ${typeof oldValue}`) + const err = new TypeError(`[${meta.constructor.name}.props.${prop}] ${typeof value} is not assignable to ${typeof oldValue}`) + console.error(err); + return false; } else if (oldValue !== value) { obj[prop] = value; effectsMap[prop]?.forEach((f) => f(value));