Skip to content

Commit

Permalink
rename LoadInput to LoadEvent - closes #4965
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed May 21, 2022
1 parent 01d9d30 commit aaa6b1b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-kangaroos-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[breaking] Rename LoadInput to LoadEvent
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ export function create_client({ target, session, base, trailing_slash }) {
const session = $session;

if (module.load) {
/** @type {import('types').LoadInput} */
/** @type {import('types').LoadEvent} */
const load_input = {
routeId,
params: uses_params,
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/page/load_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export async function load_node({
redirect: shadow.redirect
};
} else if (module.load) {
/** @type {import('types').LoadInput} */
/** @type {import('types').LoadEvent} */
const load_input = {
url: state.prerender ? create_prerendering_url_proxy(event.url) : event.url,
params: event.params,
Expand Down
6 changes: 3 additions & 3 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export interface HandleError {
}

/**
* The `(input: LoadInput) => LoadOutput` `load` function exported from `<script context="module">` in a page or layout.
* The `(input: LoadEvent) => LoadOutput` `load` function exported from `<script context="module">` in a page or layout.
*
* Note that you can use [generated types](/docs/types#generated-types) instead of manually specifying the Params generic argument.
*/
Expand All @@ -181,10 +181,10 @@ export interface Load<
InputProps extends Record<string, any> = Record<string, any>,
OutputProps extends Record<string, any> = InputProps
> {
(input: LoadInput<Params, InputProps>): MaybePromise<LoadOutput<OutputProps>>;
(input: LoadEvent<Params, InputProps>): MaybePromise<LoadOutput<OutputProps>>;
}

export interface LoadInput<
export interface LoadEvent<
Params extends Record<string, string> = Record<string, string>,
Props extends Record<string, any> = Record<string, any>
> {
Expand Down

0 comments on commit aaa6b1b

Please sign in to comment.