Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type definition: depends missing in Kit.ServerLoadEvent #6929

Closed
aloker opened this issue Sep 20, 2022 · 0 comments · Fixed by #6935
Closed

Type definition: depends missing in Kit.ServerLoadEvent #6929

aloker opened this issue Sep 20, 2022 · 0 comments · Fixed by #6935
Labels
bug Something isn't working low hanging fruit
Milestone

Comments

@aloker
Copy link
Contributor

aloker commented Sep 20, 2022

Describe the bug

Kit.ServerLoadEvent does not delare the depends function even though it exists on the object (and works)

See

export interface ServerLoadEvent<
Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
ParentData extends Record<string, any> = Record<string, any>
> extends RequestEvent<Params> {
parent: () => Promise<ParentData>;
}

export interface RequestEvent<
Params extends Partial<Record<string, string>> = Partial<Record<string, string>>
> {
cookies: Cookies;
getClientAddress: () => string;
locals: App.Locals;
params: Params;
platform: Readonly<App.Platform>;
request: Request;
routeId: string | null;
setHeaders: (headers: Record<string, string>) => void;
url: URL;
}

It should declare depends just like LoadEvent does

depends: (...deps: string[]) => void;

Reproduction

https://stackblitz.com/edit/sveltekit-depends?file=src%2Froutes%2F%2Bpage.server.ts&terminal=dev

This example tries to use depends in a PageServerLoad function. Typescript shows an error:

image

However, the code works (click the "Reload data" button) - it's only a type error.

Logs

No response

System Info

(Stackblitz)


  System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.76 
    @sveltejs/kit: next => 1.0.0-next.490 
    svelte: ^3.44.0 => 3.50.1 
    vite: ^3.0.4 => 3.1.3

Severity

serious, but I can work around it

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low hanging fruit
Projects
None yet
2 participants