Typing with route groups when using +server.layout.ts and +page.ts to load data #12269
andrewrisse
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have a typescript issue when using +server.layout.ts and +page.ts to load data for a page.
The directory structure looks like:
The [[thread_id]]/+page.svelte file uses:
export let data
To access data loaded in both the +layout.server.ts file, as well as the +page.ts file. I have confirmed the data is properly fetched, and available in the component.
The issue is Typescript is inferring the 'data' variable's type, and it only has the data loaded in the +page.ts file, not the +layout.server.ts file.
How can I get the type to be correctly inferred (including both the layout and page data.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions