feat: improve error report for type mismatch
This commit is contained in:
parent
98c89624f9
commit
bea93f69f7
1 changed files with 3 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue