Missing types from PageServerParentData
if parent layout load returns void
#7408
Labels
Milestone
PageServerParentData
if parent layout load returns void
#7408
Describe the bug
If a layout load function returns
void
at any part of the function, the types forparent()
in child load functions will be broken.Reproduction
https://stackblitz.com/github/s3812497/sveltekit-load-types-bug?file=src%2Froutes%2Fabout%2F%2Bpage.server.ts
Expected:
src/routes/about/+page.server.ts
has types when retrieving data from the parent load functionsrc/routes/+layout.server.ts
Actual:
src/routes/about/+page.server.ts
shows an error stating the property does not exist when retrieving the data fromparent()
e.g.
Property 'b' does not exist on type 'PageServerParentData'.(2339)
Logs
No response
System Info
Severity
annoyance
Additional Information
A workaround is to avoid returning void in the parent load function and return an empty object instead.
The text was updated successfully, but these errors were encountered: