@sveltejs/kit 1.0.0-next.438 → 1.0.0-next.439

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/package.json +1 -1
  2. package/src/core/sync/create_manifest_data/index.js +6 -3
  3. package/src/core/sync/sync.js +1 -1
  4. package/src/core/sync/{write_types.js → write_types/index.js} +123 -87
  5. package/src/core/sync/write_types/test/layout/+layout.js +5 -0
  6. package/src/core/sync/write_types/test/layout/+layout.server.js +5 -0
  7. package/src/core/sync/write_types/test/layout/+layout.svelte +0 -0
  8. package/src/core/sync/write_types/test/layout/+page.js +5 -0
  9. package/src/core/sync/write_types/test/layout/+page.server.js +5 -0
  10. package/src/core/sync/write_types/test/layout/+page.svelte +0 -0
  11. package/src/core/sync/write_types/test/layout/_expected/$types.d.ts +67 -0
  12. package/src/core/sync/write_types/test/layout-advanced/(main)/+layout.server.js +5 -0
  13. package/src/core/sync/write_types/test/layout-advanced/(main)/+layout.svelte +0 -0
  14. package/src/core/sync/write_types/test/layout-advanced/(main)/+page.js +5 -0
  15. package/src/core/sync/write_types/test/layout-advanced/(main)/+page@.svelte +0 -0
  16. package/src/core/sync/write_types/test/layout-advanced/(main)/sub/+page.js +5 -0
  17. package/src/core/sync/write_types/test/layout-advanced/(main)/sub/+page.svelte +0 -0
  18. package/src/core/sync/write_types/test/layout-advanced/+layout.js +5 -0
  19. package/src/core/sync/write_types/test/layout-advanced/+layout.svelte +0 -0
  20. package/src/core/sync/write_types/test/layout-advanced/_expected/$types.d.ts +32 -0
  21. package/src/core/sync/write_types/test/layout-advanced/_expected/(main)/$types.d.ts +42 -0
  22. package/src/core/sync/write_types/test/layout-advanced/_expected/(main)/sub/$types.d.ts +32 -0
  23. package/src/core/sync/write_types/test/simple-page-server-and-shared/+page.js +5 -0
  24. package/src/core/sync/write_types/test/simple-page-server-and-shared/+page.server.js +5 -0
  25. package/src/core/sync/write_types/test/simple-page-server-and-shared/+page.svelte +0 -0
  26. package/src/core/sync/write_types/test/simple-page-server-and-shared/_expected/$types.d.ts +44 -0
  27. package/src/core/sync/write_types/test/simple-page-server-only/+page.server.js +5 -0
  28. package/src/core/sync/write_types/test/simple-page-server-only/+page.svelte +0 -0
  29. package/src/core/sync/write_types/test/simple-page-server-only/_expected/$types.d.ts +30 -0
  30. package/src/core/sync/write_types/test/simple-page-shared-only/+page.js +5 -0
  31. package/src/core/sync/write_types/test/simple-page-shared-only/+page.svelte +0 -0
  32. package/src/core/sync/write_types/test/simple-page-shared-only/_expected/$types.d.ts +33 -0
  33. package/src/core/sync/write_types/test/slugs/+layout.js +1 -0
  34. package/src/core/sync/write_types/test/slugs/+layout.svelte +1 -0
  35. package/src/core/sync/write_types/test/slugs/[...rest]/+page.js +3 -0
  36. package/src/core/sync/write_types/test/slugs/[...rest]/+page.svelte +0 -0
  37. package/src/core/sync/write_types/test/slugs/[slug]/+page.js +3 -0
  38. package/src/core/sync/write_types/test/slugs/[slug]/+page.svelte +0 -0
  39. package/src/core/sync/write_types/test/slugs/_expected/$types.d.ts +35 -0
  40. package/src/core/sync/write_types/test/slugs/_expected/[...rest]/$types.d.ts +31 -0
  41. package/src/core/sync/write_types/test/slugs/_expected/[slug]/$types.d.ts +31 -0
  42. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.js +1 -0
  43. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.svelte +1 -0
  44. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/$types.d.ts +33 -0
  45. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/nested/$types.d.ts +34 -0
  46. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/nested/[...rest]/$types.d.ts +38 -0
  47. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/nested/[slug]/$types.d.ts +19 -0
  48. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.js +1 -0
  49. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.svelte +1 -0
  50. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/[...rest]/+page.js +3 -0
  51. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/[...rest]/+page.svelte +0 -0
  52. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/[slug]/+page@.svelte +0 -0
  53. package/types/ambient.d.ts +9 -0
  54. package/types/index.d.ts +1 -1
  55. package/types/internal.d.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.438",
3
+ "version": "1.0.0-next.439",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -180,7 +180,7 @@ function create_routes_and_nodes(cwd, config, fallback) {
180
180
  component: project_relative
181
181
  };
182
182
  } else if (item.is_layout) {
183
- if (!route.layout) route.layout = { depth };
183
+ if (!route.layout) route.layout = { depth, child_pages: [] };
184
184
  route.layout.component = project_relative;
185
185
  if (item.uses_layout !== undefined) route.layout.parent_id = item.uses_layout;
186
186
  } else {
@@ -189,7 +189,7 @@ function create_routes_and_nodes(cwd, config, fallback) {
189
189
  if (item.uses_layout !== undefined) route.leaf.parent_id = item.uses_layout;
190
190
  }
191
191
  } else if (item.is_layout) {
192
- if (!route.layout) route.layout = { depth };
192
+ if (!route.layout) route.layout = { depth, child_pages: [] };
193
193
  route.layout[item.kind] = project_relative;
194
194
  } else if (item.is_page) {
195
195
  if (!route.leaf) route.leaf = { depth };
@@ -223,7 +223,7 @@ function create_routes_and_nodes(cwd, config, fallback) {
223
223
  }
224
224
 
225
225
  if (!root.layout?.component) {
226
- if (!root.layout) root.layout = { depth: 0 };
226
+ if (!root.layout) root.layout = { depth: 0, child_pages: [] };
227
227
  root.layout.component = posixify(path.relative(cwd, `${fallback}/layout.svelte`));
228
228
  }
229
229
 
@@ -290,6 +290,9 @@ function create_routes_and_nodes(cwd, config, fallback) {
290
290
  }
291
291
 
292
292
  if (current_route.layout) {
293
+ /** @type {import('types').PageNode[]} */ (current_route.layout.child_pages).push(
294
+ route.leaf
295
+ );
293
296
  current_node.parent = current_node = current_route.layout;
294
297
  parent_id = current_node.parent_id;
295
298
  } else {
@@ -4,7 +4,7 @@ import { write_client_manifest } from './write_client_manifest.js';
4
4
  import { write_matchers } from './write_matchers.js';
5
5
  import { write_root } from './write_root.js';
6
6
  import { write_tsconfig } from './write_tsconfig.js';
7
- import { write_types, write_all_types } from './write_types.js';
7
+ import { write_types, write_all_types } from './write_types/index.js';
8
8
  import { write_ambient } from './write_ambient.js';
9
9
 
10
10
  /**
@@ -1,8 +1,8 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import MagicString from 'magic-string';
4
- import { posixify, rimraf, walk } from '../../utils/filesystem.js';
5
- import { compact } from '../../utils/array.js';
4
+ import { posixify, rimraf, walk } from '../../../utils/filesystem.js';
5
+ import { compact } from '../../../utils/array.js';
6
6
 
7
7
  /**
8
8
  * @typedef {{
@@ -49,9 +49,10 @@ export async function write_all_types(config, manifest_data) {
49
49
  }
50
50
  }
51
51
 
52
+ const routes_map = create_routes_map(manifest_data);
52
53
  // For each directory, write $types.d.ts
53
54
  for (const route of manifest_data.routes) {
54
- update_types(config, manifest_data, route);
55
+ update_types(config, routes_map, route);
55
56
  }
56
57
  }
57
58
 
@@ -76,16 +77,33 @@ export async function write_types(config, manifest_data, file) {
76
77
  const route = manifest_data.routes.find((route) => route.id === id);
77
78
  if (!route) return; // this shouldn't ever happen
78
79
 
79
- update_types(config, manifest_data, route);
80
+ update_types(config, create_routes_map(manifest_data), route);
80
81
  }
81
82
 
82
83
  /**
83
- *
84
- * @param {import('types').ValidatedConfig} config
84
+ * Collect all leafs into a leaf -> route map
85
85
  * @param {import('types').ManifestData} manifest_data
86
+ */
87
+ function create_routes_map(manifest_data) {
88
+ /** @type {Map<import('types').PageNode, import('types').RouteData>} */
89
+ const map = new Map();
90
+ for (const route of manifest_data.routes) {
91
+ if (route.leaf) {
92
+ map.set(route.leaf, route);
93
+ }
94
+ }
95
+ return map;
96
+ }
97
+
98
+ /**
99
+ * Update types for a specific route
100
+ * @param {import('types').ValidatedConfig} config
101
+ * @param {Map<import('types').PageNode, import('types').RouteData>} routes
86
102
  * @param {import('types').RouteData} route
87
103
  */
88
- function update_types(config, manifest_data, route) {
104
+ function update_types(config, routes, route) {
105
+ if (!route.leaf && !route.layout && !route.endpoint) return; // nothing to do
106
+
89
107
  const routes_dir = posixify(path.relative('.', config.kit.files.routes));
90
108
  const outdir = path.join(config.kit.outDir, 'types', routes_dir, route.id);
91
109
 
@@ -112,8 +130,6 @@ function update_types(config, manifest_data, route) {
112
130
  input_files.push(route.endpoint.file);
113
131
  }
114
132
 
115
- if (!route.leaf && !route.layout && !route.endpoint) return; // nothing to do
116
-
117
133
  try {
118
134
  fs.mkdirSync(outdir, { recursive: true });
119
135
  } catch {}
@@ -138,6 +154,7 @@ function update_types(config, manifest_data, route) {
138
154
  // track which old files end up being surplus to requirements
139
155
  const to_delete = new Set(output_files.map((file) => file.name));
140
156
 
157
+ // now generate new types
141
158
  const imports = [`import type * as Kit from '@sveltejs/kit';`];
142
159
 
143
160
  /** @type {string[]} */
@@ -155,32 +172,25 @@ function update_types(config, manifest_data, route) {
155
172
  declarations.push(`interface RouteParams extends Partial<Record<string, string>> {}`);
156
173
  }
157
174
 
158
- if (route.leaf) {
159
- const { data, server_data, load, server_load, errors, written_proxies } = process_node(
160
- route.leaf,
161
- outdir,
162
- 'RouteParams'
175
+ if (route.layout || route.leaf) {
176
+ // These could also be placed in our public types, but it would bloat them unnecessarily and we may want to change these in the future
177
+ declarations.push(`type MaybeWithVoid<T> = {} extends T ? T | void : T;`);
178
+ declarations.push(
179
+ `export type RequiredKeys<T> = { [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K; }[keyof T];`
163
180
  );
181
+ declarations.push(
182
+ `type OutputDataShape<T> = MaybeWithVoid<Omit<App.PageData, RequiredKeys<T>> & Partial<Pick<App.PageData, keyof T & keyof App.PageData>> & Record<string, any>>`
183
+ );
184
+ declarations.push(`type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;`);
185
+ }
164
186
 
165
- for (const file of written_proxies) to_delete.delete(file);
166
-
167
- exports.push(`export type Errors = ${errors};`);
187
+ if (route.leaf) {
188
+ const { declarations: d, exports: e, written_proxies } = process_node(route.leaf, outdir, true);
168
189
 
169
- exports.push(`export type PageData = ${data};`);
170
- if (load) {
171
- exports.push(
172
- `export type PageLoad<OutputData extends Record<string, any> | void = Record<string, any> | void> = ${load};`
173
- );
174
- exports.push('export type PageLoadEvent = Parameters<PageLoad>[0];');
175
- }
190
+ exports.push(...e);
191
+ declarations.push(...d);
176
192
 
177
- exports.push(`export type PageServerData = ${server_data};`);
178
- if (server_load) {
179
- exports.push(
180
- `export type PageServerLoad<OutputData extends Record<string, any> | void = Record<string, any> | void> = ${server_load};`
181
- );
182
- exports.push('export type PageServerLoadEvent = Parameters<PageServerLoad>[0];');
183
- }
193
+ for (const file of written_proxies) to_delete.delete(file);
184
194
 
185
195
  if (route.leaf.server) {
186
196
  exports.push(`export type Action = Kit.Action<RouteParams>`);
@@ -188,15 +198,18 @@ function update_types(config, manifest_data, route) {
188
198
  }
189
199
 
190
200
  if (route.layout) {
191
- // TODO collect children in create_manifest_data, instead of this inefficient O(n^2) algorithm
201
+ let all_pages_have_load = true;
192
202
  const layout_params = new Set();
193
- manifest_data.routes.forEach((other) => {
194
- if (other.page && other.id.startsWith(route.id + '/')) {
195
- // TODO this is O(n^2), see if we need to speed it up
196
- for (const name of other.names) {
203
+ route.layout.child_pages?.forEach((page) => {
204
+ const leaf = routes.get(page);
205
+ if (leaf) {
206
+ for (const name of leaf.names) {
197
207
  layout_params.add(name);
198
208
  }
199
209
  }
210
+ if (!page.server && !page.shared) {
211
+ all_pages_have_load = false;
212
+ }
200
213
  });
201
214
 
202
215
  if (layout_params.size > 0) {
@@ -206,29 +219,16 @@ function update_types(config, manifest_data, route) {
206
219
  declarations.push(`interface LayoutParams extends RouteParams {}`);
207
220
  }
208
221
 
209
- const { data, server_data, load, server_load, written_proxies } = process_node(
210
- route.layout,
211
- outdir,
212
- 'LayoutParams'
213
- );
222
+ const {
223
+ exports: e,
224
+ declarations: d,
225
+ written_proxies
226
+ } = process_node(route.layout, outdir, false, all_pages_have_load);
214
227
 
215
- for (const file of written_proxies) to_delete.delete(file);
216
-
217
- exports.push(`export type LayoutData = ${data};`);
218
- if (load) {
219
- exports.push(
220
- `export type LayoutLoad<OutputData extends Record<string, any> | void = Record<string, any> | void> = ${load};`
221
- );
222
- exports.push('export type LayoutLoadEvent = Parameters<LayoutLoad>[0];');
223
- }
228
+ exports.push(...e);
229
+ declarations.push(...d);
224
230
 
225
- exports.push(`export type LayoutServerData = ${server_data};`);
226
- if (server_load) {
227
- exports.push(
228
- `export type LayoutServerLoad<OutputData extends Record<string, any> | void = Record<string, any> | void> = ${server_load};`
229
- );
230
- exports.push('export type LayoutServerLoadEvent = Parameters<LayoutServerLoad>[0];');
231
- }
231
+ for (const file of written_proxies) to_delete.delete(file);
232
232
  }
233
233
 
234
234
  if (route.endpoint) {
@@ -251,18 +251,24 @@ function update_types(config, manifest_data, route) {
251
251
  /**
252
252
  * @param {import('types').PageNode} node
253
253
  * @param {string} outdir
254
- * @param {string} params
254
+ * @param {boolean} is_page
255
+ * @param {boolean} [all_pages_have_load]
255
256
  */
256
- function process_node(node, outdir, params) {
257
- let data;
258
- let load;
259
- let server_load;
260
- let errors;
257
+ function process_node(node, outdir, is_page, all_pages_have_load = true) {
258
+ const params = `${is_page ? 'Route' : 'Layout'}Params`;
259
+ const prefix = is_page ? 'Page' : 'Layout';
261
260
 
262
261
  /** @type {string[]} */
263
262
  let written_proxies = [];
263
+ /** @type {string[]} */
264
+ const declarations = [];
265
+ /** @type {string[]} */
266
+ const exports = [];
264
267
 
268
+ /** @type {string} */
265
269
  let server_data;
270
+ /** @type {string} */
271
+ let data;
266
272
 
267
273
  if (node.server) {
268
274
  const content = fs.readFileSync(node.server, 'utf8');
@@ -274,33 +280,52 @@ function process_node(node, outdir, params) {
274
280
  }
275
281
 
276
282
  server_data = get_data_type(node.server, 'null', proxy);
277
- server_load = `Kit.ServerLoad<${params}, ${get_parent_type(
278
- node,
279
- 'LayoutServerData'
280
- )}, OutputData>`;
281
283
 
282
- if (proxy) {
283
- const types = [];
284
- for (const method of ['POST', 'PUT', 'PATCH']) {
285
- if (proxy.exports.includes(method)) {
286
- // If the file wasn't tweaked, we can use the return type of the original file.
287
- // The advantage is that type updates are reflected without saving.
288
- const from = proxy.modified
289
- ? `./proxy${replace_ext_with_js(basename)}`
290
- : path_to_original(outdir, node.server);
291
-
292
- types.push(`Kit.AwaitedErrors<typeof import('${from}').${method}>`);
284
+ const parent_type = `${prefix}ServerParentData`;
285
+
286
+ declarations.push(
287
+ `type ${parent_type} = EnsureParentData<${get_parent_type(node, 'LayoutServerData')}>;`
288
+ );
289
+
290
+ // +page.js load present -> server can return all-optional data
291
+ const output_data_shape =
292
+ node.shared || (!is_page && all_pages_have_load)
293
+ ? `Partial<App.PageData> & Record<string, any> | void`
294
+ : `OutputDataShape<${parent_type}>`;
295
+ exports.push(
296
+ `export type ${prefix}ServerLoad<OutputData extends ${output_data_shape} = ${output_data_shape}> = Kit.ServerLoad<${params}, ${parent_type}, OutputData>;`
297
+ );
298
+
299
+ exports.push(`export type ${prefix}ServerLoadEvent = Parameters<${prefix}ServerLoad>[0];`);
300
+
301
+ if (is_page) {
302
+ let errors = 'unknown';
303
+ if (proxy) {
304
+ const types = [];
305
+ for (const method of ['POST', 'PUT', 'PATCH', 'DELETE']) {
306
+ if (proxy.exports.includes(method)) {
307
+ // If the file wasn't tweaked, we can use the return type of the original file.
308
+ // The advantage is that type updates are reflected without saving.
309
+ const from = proxy.modified
310
+ ? `./proxy${replace_ext_with_js(basename)}`
311
+ : path_to_original(outdir, node.server);
312
+
313
+ types.push(`Kit.AwaitedErrors<typeof import('${from}').${method}>`);
314
+ }
293
315
  }
316
+ errors = types.length ? types.join(' | ') : 'null';
294
317
  }
295
- errors = types.length ? types.join(' | ') : 'null';
296
- } else {
297
- errors = 'unknown';
318
+ exports.push(`export type Errors = ${errors};`);
298
319
  }
299
320
  } else {
300
321
  server_data = 'null';
301
322
  }
323
+ exports.push(`export type ${prefix}ServerData = ${server_data};`);
302
324
 
303
- const parent_type = get_parent_type(node, 'LayoutData');
325
+ const parent_type = `${prefix}ParentData`;
326
+ declarations.push(
327
+ `type ${parent_type} = EnsureParentData<${get_parent_type(node, 'LayoutData')}>;`
328
+ );
304
329
 
305
330
  if (node.shared) {
306
331
  const content = fs.readFileSync(node.shared, 'utf8');
@@ -310,17 +335,28 @@ function process_node(node, outdir, params) {
310
335
  written_proxies.push(`proxy${path.basename(node.shared)}`);
311
336
  }
312
337
 
313
- const type = get_data_type(node.shared, `${parent_type} & ${server_data}`, proxy);
338
+ const type = get_data_type(node.shared, `${parent_type} & ${prefix}ServerData`, proxy);
314
339
 
315
340
  data = `Omit<${parent_type}, keyof ${type}> & ${type}`;
316
- load = `Kit.Load<${params}, ${server_data}, ${parent_type}, OutputData>`;
341
+
342
+ const output_data_shape =
343
+ !is_page && all_pages_have_load
344
+ ? `Partial<App.PageData> & Record<string, any> | void`
345
+ : `OutputDataShape<${parent_type}>`;
346
+ exports.push(
347
+ `export type ${prefix}Load<OutputData extends ${output_data_shape} = ${output_data_shape}> = Kit.Load<${params}, ${prefix}ServerData, ${parent_type}, OutputData>;`
348
+ );
349
+
350
+ exports.push(`export type ${prefix}LoadEvent = Parameters<${prefix}Load>[0];`);
317
351
  } else if (server_data === 'null') {
318
352
  data = parent_type;
319
353
  } else {
320
- data = `Omit<${parent_type}, keyof ${server_data}> & ${server_data}`;
354
+ data = `Omit<${parent_type}, keyof ${prefix}ServerData> & ${prefix}ServerData`;
321
355
  }
322
356
 
323
- return { data, server_data, load, server_load, errors, written_proxies };
357
+ exports.push(`export type ${prefix}Data = ${data};`);
358
+
359
+ return { declarations, exports, written_proxies };
324
360
 
325
361
  /**
326
362
  * @param {string} file_path
@@ -364,7 +400,7 @@ function get_parent_type(node, type) {
364
400
  parent = parent.parent;
365
401
  }
366
402
 
367
- let parent_str = parent_imports[0] || 'Record<never, never>';
403
+ let parent_str = parent_imports[0] || '{}';
368
404
  for (let i = 1; i < parent_imports.length; i++) {
369
405
  // Omit is necessary because a parent could have a property with the same key which would
370
406
  // cause a type conflict. At runtime the child overwrites the parent property in this case,
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ shared: 'shared'
4
+ };
5
+ }
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ server: 'server'
4
+ };
5
+ }
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ pageShared: 'pageShared'
4
+ };
5
+ }
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ pageServer: 'pageServer'
4
+ };
5
+ }
@@ -0,0 +1,67 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ type PageServerParentData = EnsureParentData<LayoutServerData>;
15
+ type PageParentData = EnsureParentData<LayoutData>;
16
+ interface LayoutParams extends RouteParams {}
17
+ type LayoutServerParentData = EnsureParentData<{}>;
18
+ type LayoutParentData = EnsureParentData<{}>;
19
+
20
+ export type PageServerLoad<
21
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
22
+ | (Partial<App.PageData> & Record<string, any>)
23
+ | void
24
+ > = Kit.ServerLoad<RouteParams, PageServerParentData, OutputData>;
25
+ export type PageServerLoadEvent = Parameters<PageServerLoad>[0];
26
+ export type Errors = null;
27
+ export type PageServerData = Kit.AwaitedProperties<
28
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.server.js').load>>
29
+ >;
30
+ export type PageLoad<
31
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
32
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
33
+ export type PageLoadEvent = Parameters<PageLoad>[0];
34
+ export type PageData = Omit<
35
+ PageParentData,
36
+ keyof Kit.AwaitedProperties<
37
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
38
+ >
39
+ > &
40
+ Kit.AwaitedProperties<
41
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
42
+ >;
43
+ export type Action = Kit.Action<RouteParams>;
44
+ export type LayoutServerLoad<
45
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
46
+ | (Partial<App.PageData> & Record<string, any>)
47
+ | void
48
+ > = Kit.ServerLoad<LayoutParams, LayoutServerParentData, OutputData>;
49
+ export type LayoutServerLoadEvent = Parameters<LayoutServerLoad>[0];
50
+ export type LayoutServerData = Kit.AwaitedProperties<
51
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.server.js').load>>
52
+ >;
53
+ export type LayoutLoad<
54
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
55
+ | (Partial<App.PageData> & Record<string, any>)
56
+ | void
57
+ > = Kit.Load<LayoutParams, LayoutServerData, LayoutParentData, OutputData>;
58
+ export type LayoutLoadEvent = Parameters<LayoutLoad>[0];
59
+ export type LayoutData = Omit<
60
+ LayoutParentData,
61
+ keyof Kit.AwaitedProperties<
62
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
63
+ >
64
+ > &
65
+ Kit.AwaitedProperties<
66
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
67
+ >;
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ main: 'main'
4
+ };
5
+ }
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ page: 'page'
4
+ };
5
+ }
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ sub: 'sub'
4
+ };
5
+ }
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ root: 'root'
4
+ };
5
+ }
@@ -0,0 +1,32 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ interface LayoutParams extends RouteParams {}
15
+ type LayoutParentData = EnsureParentData<{}>;
16
+
17
+ export type LayoutServerData = null;
18
+ export type LayoutLoad<
19
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
20
+ | (Partial<App.PageData> & Record<string, any>)
21
+ | void
22
+ > = Kit.Load<LayoutParams, LayoutServerData, LayoutParentData, OutputData>;
23
+ export type LayoutLoadEvent = Parameters<LayoutLoad>[0];
24
+ export type LayoutData = Omit<
25
+ LayoutParentData,
26
+ keyof Kit.AwaitedProperties<
27
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
28
+ >
29
+ > &
30
+ Kit.AwaitedProperties<
31
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
32
+ >;
@@ -0,0 +1,42 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ type PageParentData = EnsureParentData<import('../$types.js').LayoutData>;
15
+ interface LayoutParams extends RouteParams {}
16
+ type LayoutServerParentData = EnsureParentData<import('../$types.js').LayoutServerData>;
17
+ type LayoutParentData = EnsureParentData<import('../$types.js').LayoutData>;
18
+
19
+ export type PageServerData = null;
20
+ export type PageLoad<
21
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
22
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
23
+ export type PageLoadEvent = Parameters<PageLoad>[0];
24
+ export type PageData = Omit<
25
+ PageParentData,
26
+ keyof Kit.AwaitedProperties<
27
+ Awaited<ReturnType<typeof import('../../../../../../../../../(main)/+page.js').load>>
28
+ >
29
+ > &
30
+ Kit.AwaitedProperties<
31
+ Awaited<ReturnType<typeof import('../../../../../../../../../(main)/+page.js').load>>
32
+ >;
33
+ export type LayoutServerLoad<
34
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
35
+ | (Partial<App.PageData> & Record<string, any>)
36
+ | void
37
+ > = Kit.ServerLoad<LayoutParams, LayoutServerParentData, OutputData>;
38
+ export type LayoutServerLoadEvent = Parameters<LayoutServerLoad>[0];
39
+ export type LayoutServerData = Kit.AwaitedProperties<
40
+ Awaited<ReturnType<typeof import('../../../../../../../../../(main)/+layout.server.js').load>>
41
+ >;
42
+ export type LayoutData = Omit<LayoutParentData, keyof LayoutServerData> & LayoutServerData;
@@ -0,0 +1,32 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ type PageParentData = EnsureParentData<
15
+ Omit<import('../../$types.js').LayoutData, keyof import('../$types.js').LayoutData> &
16
+ import('../$types.js').LayoutData
17
+ >;
18
+
19
+ export type PageServerData = null;
20
+ export type PageLoad<
21
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
22
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
23
+ export type PageLoadEvent = Parameters<PageLoad>[0];
24
+ export type PageData = Omit<
25
+ PageParentData,
26
+ keyof Kit.AwaitedProperties<
27
+ Awaited<ReturnType<typeof import('../../../../../../../../../../(main)/sub/+page.js').load>>
28
+ >
29
+ > &
30
+ Kit.AwaitedProperties<
31
+ Awaited<ReturnType<typeof import('../../../../../../../../../../(main)/sub/+page.js').load>>
32
+ >;
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ shared: 'shared'
4
+ };
5
+ }
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ server: 'server'
4
+ };
5
+ }
@@ -0,0 +1,44 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ type PageServerParentData = EnsureParentData<LayoutServerData>;
15
+ type PageParentData = EnsureParentData<LayoutData>;
16
+ interface LayoutParams extends RouteParams {}
17
+ type LayoutParentData = EnsureParentData<{}>;
18
+
19
+ export type PageServerLoad<
20
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
21
+ | (Partial<App.PageData> & Record<string, any>)
22
+ | void
23
+ > = Kit.ServerLoad<RouteParams, PageServerParentData, OutputData>;
24
+ export type PageServerLoadEvent = Parameters<PageServerLoad>[0];
25
+ export type Errors = null;
26
+ export type PageServerData = Kit.AwaitedProperties<
27
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.server.js').load>>
28
+ >;
29
+ export type PageLoad<
30
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
31
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
32
+ export type PageLoadEvent = Parameters<PageLoad>[0];
33
+ export type PageData = Omit<
34
+ PageParentData,
35
+ keyof Kit.AwaitedProperties<
36
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
37
+ >
38
+ > &
39
+ Kit.AwaitedProperties<
40
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
41
+ >;
42
+ export type Action = Kit.Action<RouteParams>;
43
+ export type LayoutServerData = null;
44
+ export type LayoutData = LayoutParentData;
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ foo: 'bar'
4
+ };
5
+ }
@@ -0,0 +1,30 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ type PageServerParentData = EnsureParentData<LayoutServerData>;
15
+ type PageParentData = EnsureParentData<LayoutData>;
16
+ interface LayoutParams extends RouteParams {}
17
+ type LayoutParentData = EnsureParentData<{}>;
18
+
19
+ export type PageServerLoad<
20
+ OutputData extends OutputDataShape<PageServerParentData> = OutputDataShape<PageServerParentData>
21
+ > = Kit.ServerLoad<RouteParams, PageServerParentData, OutputData>;
22
+ export type PageServerLoadEvent = Parameters<PageServerLoad>[0];
23
+ export type Errors = null;
24
+ export type PageServerData = Kit.AwaitedProperties<
25
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.server.js').load>>
26
+ >;
27
+ export type PageData = Omit<PageParentData, keyof PageServerData> & PageServerData;
28
+ export type Action = Kit.Action<RouteParams>;
29
+ export type LayoutServerData = null;
30
+ export type LayoutData = LayoutParentData;
@@ -0,0 +1,5 @@
1
+ export function load() {
2
+ return {
3
+ shared: 'shared'
4
+ };
5
+ }
@@ -0,0 +1,33 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ type PageParentData = EnsureParentData<LayoutData>;
15
+ interface LayoutParams extends RouteParams {}
16
+ type LayoutParentData = EnsureParentData<{}>;
17
+
18
+ export type PageServerData = null;
19
+ export type PageLoad<
20
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
21
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
22
+ export type PageLoadEvent = Parameters<PageLoad>[0];
23
+ export type PageData = Omit<
24
+ PageParentData,
25
+ keyof Kit.AwaitedProperties<
26
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
27
+ >
28
+ > &
29
+ Kit.AwaitedProperties<
30
+ Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
31
+ >;
32
+ export type LayoutServerData = null;
33
+ export type LayoutData = LayoutParentData;
@@ -0,0 +1 @@
1
+ export function load() {}
@@ -0,0 +1 @@
1
+ export function load() {}
@@ -0,0 +1,3 @@
1
+ export function load() {
2
+ return { rest: 'rest' };
3
+ }
@@ -0,0 +1,3 @@
1
+ export function load() {
2
+ return { slug: 'slug' };
3
+ }
@@ -0,0 +1,35 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ interface LayoutParams extends RouteParams {
15
+ rest?: string;
16
+ slug?: string;
17
+ }
18
+ type LayoutParentData = EnsureParentData<{}>;
19
+
20
+ export type LayoutServerData = null;
21
+ export type LayoutLoad<
22
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
23
+ | (Partial<App.PageData> & Record<string, any>)
24
+ | void
25
+ > = Kit.Load<LayoutParams, LayoutServerData, LayoutParentData, OutputData>;
26
+ export type LayoutLoadEvent = Parameters<LayoutLoad>[0];
27
+ export type LayoutData = Omit<
28
+ LayoutParentData,
29
+ keyof Kit.AwaitedProperties<
30
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
31
+ >
32
+ > &
33
+ Kit.AwaitedProperties<
34
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
35
+ >;
@@ -0,0 +1,31 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {
4
+ rest: string;
5
+ }
6
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
7
+ export type RequiredKeys<T> = {
8
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
9
+ }[keyof T];
10
+ type OutputDataShape<T> = MaybeWithVoid<
11
+ Omit<App.PageData, RequiredKeys<T>> &
12
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
13
+ Record<string, any>
14
+ >;
15
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
16
+ type PageParentData = EnsureParentData<import('../$types.js').LayoutData>;
17
+
18
+ export type PageServerData = null;
19
+ export type PageLoad<
20
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
21
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
22
+ export type PageLoadEvent = Parameters<PageLoad>[0];
23
+ export type PageData = Omit<
24
+ PageParentData,
25
+ keyof Kit.AwaitedProperties<
26
+ Awaited<ReturnType<typeof import('../../../../../../../../../[...rest]/+page.js').load>>
27
+ >
28
+ > &
29
+ Kit.AwaitedProperties<
30
+ Awaited<ReturnType<typeof import('../../../../../../../../../[...rest]/+page.js').load>>
31
+ >;
@@ -0,0 +1,31 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {
4
+ slug: string;
5
+ }
6
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
7
+ export type RequiredKeys<T> = {
8
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
9
+ }[keyof T];
10
+ type OutputDataShape<T> = MaybeWithVoid<
11
+ Omit<App.PageData, RequiredKeys<T>> &
12
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
13
+ Record<string, any>
14
+ >;
15
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
16
+ type PageParentData = EnsureParentData<import('../$types.js').LayoutData>;
17
+
18
+ export type PageServerData = null;
19
+ export type PageLoad<
20
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
21
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
22
+ export type PageLoadEvent = Parameters<PageLoad>[0];
23
+ export type PageData = Omit<
24
+ PageParentData,
25
+ keyof Kit.AwaitedProperties<
26
+ Awaited<ReturnType<typeof import('../../../../../../../../../[slug]/+page.js').load>>
27
+ >
28
+ > &
29
+ Kit.AwaitedProperties<
30
+ Awaited<ReturnType<typeof import('../../../../../../../../../[slug]/+page.js').load>>
31
+ >;
@@ -0,0 +1,33 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ interface LayoutParams extends RouteParams {
15
+ rest?: string;
16
+ slug?: string;
17
+ }
18
+ type LayoutParentData = EnsureParentData<{}>;
19
+
20
+ export type LayoutServerData = null;
21
+ export type LayoutLoad<
22
+ OutputData extends OutputDataShape<LayoutParentData> = OutputDataShape<LayoutParentData>
23
+ > = Kit.Load<LayoutParams, LayoutServerData, LayoutParentData, OutputData>;
24
+ export type LayoutLoadEvent = Parameters<LayoutLoad>[0];
25
+ export type LayoutData = Omit<
26
+ LayoutParentData,
27
+ keyof Kit.AwaitedProperties<
28
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
29
+ >
30
+ > &
31
+ Kit.AwaitedProperties<
32
+ Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
33
+ >;
@@ -0,0 +1,34 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {}
4
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
+ export type RequiredKeys<T> = {
6
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
+ }[keyof T];
8
+ type OutputDataShape<T> = MaybeWithVoid<
9
+ Omit<App.PageData, RequiredKeys<T>> &
10
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
+ Record<string, any>
12
+ >;
13
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
+ interface LayoutParams extends RouteParams {
15
+ rest?: string;
16
+ }
17
+ type LayoutParentData = EnsureParentData<import('../$types.js').LayoutData>;
18
+
19
+ export type LayoutServerData = null;
20
+ export type LayoutLoad<
21
+ OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
22
+ | (Partial<App.PageData> & Record<string, any>)
23
+ | void
24
+ > = Kit.Load<LayoutParams, LayoutServerData, LayoutParentData, OutputData>;
25
+ export type LayoutLoadEvent = Parameters<LayoutLoad>[0];
26
+ export type LayoutData = Omit<
27
+ LayoutParentData,
28
+ keyof Kit.AwaitedProperties<
29
+ Awaited<ReturnType<typeof import('../../../../../../../../../nested/+layout.js').load>>
30
+ >
31
+ > &
32
+ Kit.AwaitedProperties<
33
+ Awaited<ReturnType<typeof import('../../../../../../../../../nested/+layout.js').load>>
34
+ >;
@@ -0,0 +1,38 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {
4
+ rest: string;
5
+ }
6
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
7
+ export type RequiredKeys<T> = {
8
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
9
+ }[keyof T];
10
+ type OutputDataShape<T> = MaybeWithVoid<
11
+ Omit<App.PageData, RequiredKeys<T>> &
12
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
13
+ Record<string, any>
14
+ >;
15
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
16
+ type PageParentData = EnsureParentData<
17
+ Omit<import('../../$types.js').LayoutData, keyof import('../$types.js').LayoutData> &
18
+ import('../$types.js').LayoutData
19
+ >;
20
+
21
+ export type PageServerData = null;
22
+ export type PageLoad<
23
+ OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
24
+ > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
25
+ export type PageLoadEvent = Parameters<PageLoad>[0];
26
+ export type PageData = Omit<
27
+ PageParentData,
28
+ keyof Kit.AwaitedProperties<
29
+ Awaited<
30
+ ReturnType<typeof import('../../../../../../../../../../nested/[...rest]/+page.js').load>
31
+ >
32
+ >
33
+ > &
34
+ Kit.AwaitedProperties<
35
+ Awaited<
36
+ ReturnType<typeof import('../../../../../../../../../../nested/[...rest]/+page.js').load>
37
+ >
38
+ >;
@@ -0,0 +1,19 @@
1
+ import type * as Kit from '@sveltejs/kit';
2
+
3
+ interface RouteParams extends Partial<Record<string, string>> {
4
+ slug: string;
5
+ }
6
+ type MaybeWithVoid<T> = {} extends T ? T | void : T;
7
+ export type RequiredKeys<T> = {
8
+ [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
9
+ }[keyof T];
10
+ type OutputDataShape<T> = MaybeWithVoid<
11
+ Omit<App.PageData, RequiredKeys<T>> &
12
+ Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
13
+ Record<string, any>
14
+ >;
15
+ type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
16
+ type PageParentData = EnsureParentData<import('../../$types.js').LayoutData>;
17
+
18
+ export type PageServerData = null;
19
+ export type PageData = PageParentData;
@@ -0,0 +1,3 @@
1
+ export function load() {
2
+ return { rest: 'rest' };
3
+ }
@@ -7,6 +7,8 @@
7
7
  * declare namespace App {
8
8
  * interface Locals {}
9
9
  *
10
+ * interface PageData {}
11
+ *
10
12
  * interface Platform {}
11
13
  *
12
14
  * interface PrivateEnv {}
@@ -47,6 +49,13 @@ declare namespace App {
47
49
  */
48
50
  export interface Locals {}
49
51
 
52
+ /**
53
+ * Defines the common shape of the [$page.data store](https://kit.svelte.dev/docs/modules#$app-stores-page) - that is, the data that is shared between all pages.
54
+ * The `Load` and `ServerLoad` functions in `./$types` will be narrowed accordingly.
55
+ * Use optional properties for data that is only present on specific pages. Do not add an index signature (`[key: string]: any`).
56
+ */
57
+ export interface PageData {}
58
+
50
59
  /**
51
60
  * If your adapter provides [platform-specific context](https://kit.svelte.dev/docs/adapters#supported-environments-platform-specific-context) via `event.platform`, you can specify it here.
52
61
  */
package/types/index.d.ts CHANGED
@@ -228,7 +228,7 @@ export interface Page<Params extends Record<string, string> = Record<string, str
228
228
  routeId: string | null;
229
229
  status: number;
230
230
  error: HttpError | Error | null;
231
- data: Record<string, any>;
231
+ data: App.PageData & Record<string, any>;
232
232
  }
233
233
 
234
234
  export interface ParamMatcher {
@@ -122,6 +122,10 @@ export interface PageNode {
122
122
  server?: string;
123
123
  parent_id?: string;
124
124
  parent?: PageNode;
125
+ /**
126
+ * Filled with the pages that reference this layout (if this is a layout)
127
+ */
128
+ child_pages?: PageNode[];
125
129
  }
126
130
 
127
131
  export type PayloadScriptAttributes =