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
Generated PageData
type is never
when a page.server.ts
load
returns void
, regardless of data returned from layouts further up the tree
#6950
Comments
This was due to This seems to be the source of the "deleted file" problem. It doesn't check whether the file (say kit/packages/kit/src/core/sync/write_types/index.js Lines 40 to 47 in d19964a
|
As for the first issue (a export type ServerLoad<
Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
ParentData extends Record<string, any> = Record<string, any>,
OutputData extends Record<string, any> | void = Record<string, any> | void
> = (event: ServerLoadEvent<Params, ParentData>) => MaybePromise<OutputData>; Is there a reason we are defining the functions as |
|
Describe the bug
A minor typing thing, but it may be a bug in how types are generated .
Given the routes...
...and the
load
s......the generated
PageData
types forsrc/routes
andsrc/routes/bad
are:Only
src/routes/good
has the "correct" type (since, I assume, the load returns{}
rather thanvoid
)...Kit.ServerLoad
is advertised as able to returnvoid
:kit/packages/kit/types/index.d.ts
Lines 373 to 379 in 2776f33
So, maybe the
void
should be removed? I'd be fine returning{}
if necessary.Weirdly, though, the
void
returned fromsrc/routes/bad/+page.server.ts
is apparently bricking the type forsrc/routes
, up the tree.Reproduction
https://github.com/cdcarson/sk-void-load-gen-types-issue.git
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: