-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Describe the problem
Consider src/routes/[foo]/[bar]/[baz]/+page.svelte route.
In the src/routes/[foo]/[bar]/+layout.ts's load function,
params.foo: stringparams.bar: stringparams.baz?: string | undefined
params.baz can be accessed, but it is not documented.
Current documentation.
// .svelte-kit/types/src/routes/[foo]/[bar]/[baz]/$types.d.ts
import type * as Kit from '@sveltejs/kit';
type RouteParams = {
foo: string;
bar: string;
baz: string;
}
export type PageServerLoad = Kit.ServerLoad<RouteParams>;
export type PageLoad = Kit.Load<RouteParams>;Demo - Consider the following project structure.
.
└── src/
└── routes/
└── [foo]/
└── [bar]/
├── [baz]/
│ └── +page.server.js
└── +layout.server.js
The following types are generated by SvelteKit. (partially omitted)
// .svelte-kit/types/src/routes/[foo]/[bar]/[baz]/$types.d.ts
import type * as Kit from '@sveltejs/kit';
type RouteParams = { foo: string; bar: string; baz: string }
export type PageServerLoad = Kit.ServerLoad<RouteParams, PageServerParentData, OutputData, RouteId>;// .svelte-kit/types/src/routes/[foo]/[bar]/$types.d.ts
import type * as Kit from '@sveltejs/kit';
type RouteParams = { foo: string; bar: string }
type LayoutParams = RouteParams & { foo?: string,bar?: string,baz?: string }
// type LayoutParams = { foo: string, bar: string, baz?: string | undefined }
export type LayoutServerLoad = Kit.ServerLoad<LayoutParams, LayoutServerParentData, OutputData, LayoutRouteId>;Describe the proposed solution
Add documentations to
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation