You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: In Svelte 5, I've encountered an issue with type inference when using the load function in +page.server.ts.
When I pass a direct object as an argument to the load function, the type inference fails on the corresponding +page.svelte file. However, if I encapsulate the object inside another object (e.g., { obj }), the type inference works correctly.
Steps to Reproduce:
Create a +page.server.ts file.
Implement a load function that returns a direct object with the type or null, e.g., return { key: value }.]
Attempt to use the returned data in the +page.svelte file and observe the lack of type inference.
Modify the load function to return an encapsulated object, e.g., return { obj: { key: value } }.
Observe that the type inference now works correctly.
Expected Behavior: The type inference should work correctly even when passing a direct object in the load function.
Actual Behavior: Type inference fails when passing a direct object, requiring encapsulation to work properly.
Describe the bug
Description: In Svelte 5, I've encountered an issue with type inference when using the load function in +page.server.ts.
When I pass a direct object as an argument to the load function, the type inference fails on the corresponding +page.svelte file. However, if I encapsulate the object inside another object (e.g., { obj }), the type inference works correctly.
Steps to Reproduce:
Create a +page.server.ts file.
Implement a load function that returns a direct object with the type or null, e.g., return { key: value }.]
Attempt to use the returned data in the +page.svelte file and observe the lack of type inference.
Modify the load function to return an encapsulated object, e.g., return { obj: { key: value } }.
Observe that the type inference now works correctly.
Expected Behavior: The type inference should work correctly even when passing a direct object in the load function.
Actual Behavior: Type inference fails when passing a direct object, requiring encapsulation to work properly.
Reproduction
Direct object:
With encapsulation:
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: