kit
kit copied to clipboard
[Sveltekit 2.1.0] `onNavigate` callback return type is wrong
Describe the bug
Since Sveltekit 2.1.0 (specifically this PR https://github.com/sveltejs/kit/pull/11340/files#diff-9e558fcdee2759e3a180281c10a134e7caa6123e746f91178e20ec1b9d61be76R1964), the onNavigate
callback return type has been updated to MaybePromise<void>
, whereas it was MaybePromise<void | () => void>
before. Since the docs still mention that we can return a function (or a promise that resolves to a function), I'm assuming that this type was incorrectly changed.
Reproduction
Go to https://stackblitz.com/edit/sveltejs-kit-template-default-usx2yu?description=The%20default%20SvelteKit%20template,%20generated%20with%20create-svelte&file=src%2Froutes%2F%2Blayout.svelte,package.json&title=SvelteKit%20Default%20Template
and run npm run check
to view the error.
Logs
No response
System Info
System:
OS: macOS 12.7.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 40.65 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 20.6.0 - ~/.nvm/versions/node/v20.6.0/bin/node
npm: 9.8.1 - ~/.nvm/versions/node/v20.6.0/bin/npm
pnpm: 8.9.2 - ~/Library/pnpm/pnpm
bun: 1.0.0 - ~/.nvm/versions/node/v20.6.0/bin/bun
Browsers:
Brave Browser: 116.1.57.53
Chrome: 120.0.6099.199
Safari: 17.1.2
npmPackages:
@sveltejs/adapter-vercel: 4.0.4 => 4.0.4
@sveltejs/kit: 2.1.2 => 2.1.2
@sveltejs/vite-plugin-svelte: 3.0.1 => 3.0.1
svelte: 4.2.8 => 4.2.8
Severity
annoyance
Additional Information
No response