Skip to content

Commit

Permalink
fix: amend onNavigate type (#11599)
Browse files Browse the repository at this point in the history
closes #11564
  • Loading branch information
Rich-Harris authored Jan 11, 2024
1 parent d93eb42 commit 4cadb01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-dots-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: amend onNavigate type
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ export function beforeNavigate(callback) {
* If a function (or a `Promise` that resolves to a function) is returned from the callback, it will be called once the DOM has updated.
*
* `onNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
* @param {(navigation: import('@sveltejs/kit').OnNavigate) => import('types').MaybePromise<void>} callback
* @param {(navigation: import('@sveltejs/kit').OnNavigate) => import('types').MaybePromise<(() => void) | void>} callback
* @returns {void}
*/
export function onNavigate(callback) {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ declare module '$app/navigation' {
*
* `onNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
* */
export function onNavigate(callback: (navigation: import('@sveltejs/kit').OnNavigate) => MaybePromise<void>): void;
export function onNavigate(callback: (navigation: import('@sveltejs/kit').OnNavigate) => MaybePromise<(() => void) | void>): void;
/**
* If called when the page is being updated following a navigation (in `onMount` or `afterNavigate` or an action, for example), this disables SvelteKit's built-in scroll handling.
* This is generally discouraged, since it breaks user expectations.
Expand Down

0 comments on commit 4cadb01

Please sign in to comment.