Skip to content

Commit c47eaf3

Browse files
committed
regenerate
1 parent 74c626a commit c47eaf3

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

packages/svelte/src/internal/shared/errors.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ export function lifecycle_outside_component(name) {
5151
}
5252
}
5353

54+
/**
55+
* Context was not set in a parent component
56+
* @returns {never}
57+
*/
58+
export function missing_context() {
59+
if (DEV) {
60+
const error = new Error(`missing_context\nContext was not set in a parent component\nhttps://svelte.dev/e/missing_context`);
61+
62+
error.name = 'Svelte error';
63+
64+
throw error;
65+
} else {
66+
throw new Error(`https://svelte.dev/e/missing_context`);
67+
}
68+
}
69+
5470
/**
5571
* Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.
5672
* @returns {never}
@@ -98,20 +114,4 @@ export function svelte_element_invalid_this_value() {
98114
} else {
99115
throw new Error(`https://svelte.dev/e/svelte_element_invalid_this_value`);
100116
}
101-
}
102-
103-
/**
104-
* Context was not set in a parent component
105-
* @returns {never}
106-
*/
107-
export function missing_context() {
108-
if (DEV) {
109-
const error = new Error(`missing_context\nContext was not set in a parent component\nhttps://svelte.dev/e/missing_context`);
110-
111-
error.name = 'Svelte error';
112-
113-
throw error;
114-
} else {
115-
throw new Error(`https://svelte.dev/e/missing_context`);
116-
}
117117
}

packages/svelte/types/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ declare module 'svelte' {
448448
}): Snippet<Params>;
449449
/** Anything except a function */
450450
type NotFunction<T> = T extends Function ? never : T;
451+
/**
452+
* Returns a `[get, set]` pair of functions for working with context in a type-safe way.
453+
* */
451454
export function createContext<T>(): [() => T, (context: T) => T];
452455
/**
453456
* Retrieves the context that belongs to the closest parent component with the specified `key`.

0 commit comments

Comments
 (0)