pull/12916/head
Rich Harris 2 years ago
parent 4e06fa27ab
commit cc991d0628

@ -348,6 +348,16 @@ export function rune_missing_parentheses(node) {
e(node, "rune_missing_parentheses", "Cannot use rune without parentheses");
}
/**
* The `%name%` rune has been removed
* @param {null | number | NodeLike} node
* @param {string} name
* @returns {never}
*/
export function rune_removed(node, name) {
e(node, "rune_removed", `The \`${name}\` rune has been removed`);
}
/**
* `%name%` is now `%replacement%`
* @param {null | number | NodeLike} node
@ -424,16 +434,6 @@ export function store_invalid_subscription_module(node) {
e(node, "store_invalid_subscription_module", "Cannot reference store value outside a `.svelte` file");
}
/**
* The `%name%` rune has been removed
* @param {null | number | NodeLike} node
* @param {string} name
* @returns {never}
*/
export function rune_removed(node, name) {
e(node, "rune_removed", `The \`${name}\` rune has been removed`);
}
/**
* Declaration cannot be empty
* @param {null | number | NodeLike} node

@ -279,65 +279,65 @@ export function rune_outside_svelte(rune) {
}
/**
* Cannot set prototype of `$state` object
* Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
* @returns {never}
*/
export function state_prototype_fixed() {
export function state_descriptors_fixed() {
if (DEV) {
const error = new Error(`state_prototype_fixed\nCannot set prototype of \`$state\` object`);
const error = new Error(`state_descriptors_fixed\nProperty descriptors defined on \`$state\` objects must contain \`value\` and always be \`enumerable\`, \`configurable\` and \`writable\`.`);
error.name = 'Svelte error';
throw error;
} else {
// TODO print a link to the documentation
throw new Error("state_prototype_fixed");
throw new Error("state_descriptors_fixed");
}
}
/**
* Updating state inside a derived is forbidden. If the value should not be reactive, declare it without `$state`
* Cannot set prototype of `$state` object
* @returns {never}
*/
export function state_unsafe_mutation() {
export function state_prototype_fixed() {
if (DEV) {
const error = new Error(`state_unsafe_mutation\nUpdating state inside a derived is forbidden. If the value should not be reactive, declare it without \`$state\``);
const error = new Error(`state_prototype_fixed\nCannot set prototype of \`$state\` object`);
error.name = 'Svelte error';
throw error;
} else {
// TODO print a link to the documentation
throw new Error("state_unsafe_mutation");
throw new Error("state_prototype_fixed");
}
}
/**
* The `this={...}` property of a `<svelte:component>` must be a Svelte component, if defined
* Updating state inside a derived is forbidden. If the value should not be reactive, declare it without `$state`
* @returns {never}
*/
export function svelte_component_invalid_this_value() {
export function state_unsafe_mutation() {
if (DEV) {
const error = new Error(`svelte_component_invalid_this_value\nThe \`this={...}\` property of a \`<svelte:component>\` must be a Svelte component, if defined`);
const error = new Error(`state_unsafe_mutation\nUpdating state inside a derived is forbidden. If the value should not be reactive, declare it without \`$state\``);
error.name = 'Svelte error';
throw error;
} else {
// TODO print a link to the documentation
throw new Error("svelte_component_invalid_this_value");
throw new Error("state_unsafe_mutation");
}
}
/**
* Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
* The `this={...}` property of a `<svelte:component>` must be a Svelte component, if defined
* @returns {never}
*/
export function state_descriptors_fixed() {
export function svelte_component_invalid_this_value() {
if (DEV) {
const error = new Error(`state_descriptors_fixed\nProperty descriptors defined on \`$state\` objects must contain \`value\` and always be \`enumerable\`, \`configurable\` and \`writable\`.`);
const error = new Error(`svelte_component_invalid_this_value\nThe \`this={...}\` property of a \`<svelte:component>\` must be a Svelte component, if defined`);
error.name = 'Svelte error';
throw error;
} else {
// TODO print a link to the documentation
throw new Error("state_descriptors_fixed");
throw new Error("svelte_component_invalid_this_value");
}
}

@ -2935,27 +2935,6 @@ declare namespace $state {
*/
export function snapshot<T>(state: T): Snapshot<T>;
/**
* Compare two values, one or both of which is a reactive `$state(...)` proxy.
*
* Example:
* ```ts
* <script>
* let foo = $state({});
* let bar = {};
*
* foo.bar = bar;
*
* console.log(foo.bar === bar); // false — `foo.bar` is a reactive proxy
* console.log($state.is(foo.bar, bar)); // true
* </script>
* ```
*
* https://svelte-5-preview.vercel.app/docs/runes#$state.is
*
*/
export function is(a: any, b: any): boolean;
// prevent intellisense from being unhelpful
/** @deprecated */
export const apply: never;

Loading…
Cancel
Save