From dfc5e141d3c7bc3f3164abb21bdff248a519cf87 Mon Sep 17 00:00:00 2001 From: Chris Kerr Date: Mon, 9 Jan 2023 10:37:10 +1000 Subject: [PATCH] updated.check() changed to promise --- .changeset/dry-poets-crash.md | 5 +++++ packages/kit/src/runtime/client/utils.js | 1 + packages/kit/types/ambient.d.ts | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/dry-poets-crash.md diff --git a/.changeset/dry-poets-crash.md b/.changeset/dry-poets-crash.md new file mode 100644 index 000000000000..58eeacb84b11 --- /dev/null +++ b/.changeset/dry-poets-crash.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +`updated.check()` type changed to Promise diff --git a/packages/kit/src/runtime/client/utils.js b/packages/kit/src/runtime/client/utils.js index 8e1a047648d4..aa14bcce779f 100644 --- a/packages/kit/src/runtime/client/utils.js +++ b/packages/kit/src/runtime/client/utils.js @@ -211,6 +211,7 @@ export function create_updated_store() { /** @type {NodeJS.Timeout} */ let timeout; + /** @type {() => Promise} */ async function check() { if (DEV || !BROWSER) return false; diff --git a/packages/kit/types/ambient.d.ts b/packages/kit/types/ambient.d.ts index efcc1904d853..a8bd4cf9fc06 100644 --- a/packages/kit/types/ambient.d.ts +++ b/packages/kit/types/ambient.d.ts @@ -320,7 +320,7 @@ declare module '$app/stores' { /** * A readable store whose initial value is `false`. If [`version.pollInterval`](https://kit.svelte.dev/docs/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. */ - export const updated: Readable & { check(): boolean }; + export const updated: Readable & { check(): Promise }; /** * A function that returns all of the contextual stores. On the server, this must be called during component initialization.