Skip to content

Commit

Permalink
fix: the type of Navigation.type (#10599)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjan-purbey committed Aug 23, 2023
1 parent 57d8370 commit 998fe2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-otters-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: adjust the type of `Navigation["type"]`
6 changes: 3 additions & 3 deletions packages/kit/src/exports/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ export interface Navigation {
* - `goto`: Navigation was triggered by a `goto(...)` call or a redirect
* - `popstate`: Navigation was triggered by back/forward navigation
*/
type: Omit<NavigationType, 'enter'>;
type: Exclude<NavigationType, 'enter'>;
/**
* Whether or not the navigation will result in the page being unloaded (i.e. not a client-side navigation)
*/
Expand All @@ -875,7 +875,7 @@ export interface BeforeNavigate extends Navigation {
/**
* The argument passed to [`afterNavigate`](https://kit.svelte.dev/docs/modules#$app-navigation-afternavigate) callbacks.
*/
export interface AfterNavigate extends Navigation {
export interface AfterNavigate extends Omit<Navigation, 'type'> {
/**
* The type of navigation:
* - `enter`: The app has hydrated
Expand All @@ -884,7 +884,7 @@ export interface AfterNavigate extends Navigation {
* - `goto`: Navigation was triggered by a `goto(...)` call or a redirect
* - `popstate`: Navigation was triggered by back/forward navigation
*/
type: Omit<NavigationType, 'leave'>;
type: Exclude<NavigationType, 'leave'>;
/**
* Since `afterNavigate` is called after a navigation completes, it will never be called with a navigation that unloads the page.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ export function create_client(app, target) {
/**
* @param {{
* url: URL;
* type: import('@sveltejs/kit').NavigationType;
* type: import('@sveltejs/kit').Navigation["type"];
* intent?: import('./types').NavigationIntent;
* delta?: number;
* }} opts
Expand Down Expand Up @@ -955,7 +955,7 @@ export function create_client(app, target) {
* replaceState: boolean;
* state: any;
* } | null;
* type: import('@sveltejs/kit').NavigationType;
* type: import('@sveltejs/kit').Navigation["type"];
* delta?: number;
* nav_token?: {};
* accepted: () => void;
Expand Down

0 comments on commit 998fe2f

Please sign in to comment.