pull/11610/head
Rich Harris 2 years ago
parent f889aba57a
commit 27ae2964ee

@ -1,6 +1,6 @@
import { DEV } from 'esm-env';
import * as w from '../warnings.js';
import { get_proxied_value } from '../proxy';
import { get_proxied_value } from '../proxy.js';
export function init_array_prototype_warnings() {
const array_prototype = Array.prototype;

@ -74,12 +74,12 @@ export function ownership_invalid_mutation(component, owner) {
}
/**
* Detected an equality check between a $state proxy and a non-$state-proxy object for %method%. This equality check will always fail because the proxy has a different object identity. To ensure both operands are of the same kind for accurate results, consider using the `$state.is(a, b)` rune.
* Detected an equality check between a $state proxy and a non-$state-proxy object for %method%. This equality check will always fail because the proxy has a different object identity. To ensure both operands are of the same kind for accurate results, consider using `$state.is(a, b)`.
* @param {string} method
*/
export function state_proxy_equality_mismatch(method) {
if (DEV) {
console.warn(`%c[svelte] ${"state_proxy_equality_mismatch"}\n%c${`Detected an equality check between a $state proxy and a non-$state-proxy object for ${method}. This equality check will always fail because the proxy has a different object identity. To ensure both operands are of the same kind for accurate results, consider using the \`$state.is(a, b)\` rune.`}`, bold, normal);
console.warn(`%c[svelte] ${"state_proxy_equality_mismatch"}\n%c${`Detected an equality check between a $state proxy and a non-$state-proxy object for ${method}. This equality check will always fail because the proxy has a different object identity. To ensure both operands are of the same kind for accurate results, consider using \`$state.is(a, b)\`.`}`, bold, normal);
} else {
// TODO print a link to the documentation
console.warn("state_proxy_equality_mismatch");

Loading…
Cancel
Save