From 102e4a5ae5b29624302163faf5a20c94a64a5b2c Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Tue, 19 Dec 2023 16:30:31 +0100 Subject: [PATCH] fix: goto type include state (#11398) * fix: goto type include state * Create mighty-rockets-work.md * generate types * fix type --- .changeset/mighty-rockets-work.md | 5 +++++ packages/kit/src/runtime/app/navigation.js | 2 +- packages/kit/types/index.d.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/mighty-rockets-work.md diff --git a/.changeset/mighty-rockets-work.md b/.changeset/mighty-rockets-work.md new file mode 100644 index 000000000000..440676df82f3 --- /dev/null +++ b/.changeset/mighty-rockets-work.md @@ -0,0 +1,5 @@ +--- +"@sveltejs/kit": patch +--- + +fix: goto type include state diff --git a/packages/kit/src/runtime/app/navigation.js b/packages/kit/src/runtime/app/navigation.js index f925ebe3ea12..4e38b9966ee7 100644 --- a/packages/kit/src/runtime/app/navigation.js +++ b/packages/kit/src/runtime/app/navigation.js @@ -11,7 +11,7 @@ export const disableScrollHandling = /* @__PURE__ */ client_method('disable_scro * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`. * For external URLs, use `window.location = url` instead of calling `goto(url)`. * - * @type {(url: string | URL, opts?: { replaceState?: boolean; noScroll?: boolean; keepFocus?: boolean; invalidateAll?: boolean; }) => Promise} + * @type {(url: string | URL, opts?: { replaceState?: boolean; noScroll?: boolean; keepFocus?: boolean; invalidateAll?: boolean; state?: App.PageState }) => Promise} * @param {string | URL} url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app. * @param {Object} [opts] Options related to the navigation * @param {boolean} [opts.replaceState] If `true`, will replace the current `history` entry rather than creating a new one with `pushState` diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index 0e2b7713afbd..02fbb0c69cc0 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -1959,6 +1959,7 @@ declare module '$app/navigation' { noScroll?: boolean; keepFocus?: boolean; invalidateAll?: boolean; + state?: App.PageState; }) => Promise; /** * Causes any `load` functions belonging to the currently active page to re-run if they depend on the `url` in question, via `fetch` or `depends`. Returns a `Promise` that resolves when the page is subsequently updated.