Description
Describe the bug
When running svelte-check
against a new project with a +page.ts
that uses the PageLoad
type, the PageLoad
type is not used in the generated proxy+page.ts
in the .svelte-kit
directory. This causes the hint 'PageLoad' is declared but its value is never read
to be thrown.
Reproduction
Create a new Svelte Kit app:
npm create svelte@latest my-app
Need to install the following packages:
create-svelte@latest
Ok to proceed? (y) y
create-svelte version 2.0.0-next.161
Welcome to SvelteKit!
This is beta software; expect bugs and missing features.
Problems? Open an issue on https://github.com/sveltejs/kit/issues if none exists already.
✔ Which Svelte app template? › SvelteKit demo app
✔ Add type checking with TypeScript? › Yes, using TypeScript syntax
✔ Add ESLint for code linting? Yes
✔ Add Prettier for code formatting? Yes
✔ Add Playwright for browser testing? Yes
Install dependencies:
cd my-app
npm i
Add the following code to the end of src/routes/about/+page.ts
:
import type { PageLoad } from './$types';
export const load: PageLoad = () => {
console.log('loading about page');
return {};
};
Run Svelte Check:
npm run check
Logs
npm run check
> my-app@0.0.1 check
> svelte-kit sync && svelte-check --tsconfig ./tsconfig.json
====================================
Loading svelte-check in workspace: /Users/ccamargo/Projects/my-app
Getting Svelte diagnostics...
/Users/ccamargo/Projects/my-app/.svelte-kit/types/src/routes/about/proxy+page.ts:15:1
Hint: 'PageLoad' is declared but its value is never read.
import type { PageLoad } from './$types';
System Info
System:
OS: macOS 11.6.8
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 275.84 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/opt/node@16/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.5.0 - /usr/local/opt/node@16/bin/npm
Browsers:
Chrome: 104.0.5112.101
Edge: 104.0.1293.63
Firefox: 101.0.1
Safari: 15.6
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.66
@sveltejs/kit: next => 1.0.0-next.440
svelte: ^3.46.0 => 3.49.0
vite: ^3.0.8 => 3.0.9
Severity
annoyance
Additional Information
Here is the resulting section of the proxy+page.ts
file in .svelte-kit
:
import type { PageLoad } from './$types';
export const load = () => {
console.log('loading about page');
return {};
};
Notice PageLoad
is imported but not used.