Skip to content

Commit

Permalink
rename LoadInput to LoadEvent (#5015)
Browse files Browse the repository at this point in the history
* rename LoadInput to LoadEvent - closes #4965

* Update packages/kit/types/index.d.ts

Co-authored-by: Maurício Kishi <mrkishi@users.noreply.github.com>

* Update packages/kit/types/index.d.ts

Co-authored-by: Maurício Kishi <mrkishi@users.noreply.github.com>

Co-authored-by: Maurício Kishi <mrkishi@users.noreply.github.com>
  • Loading branch information
Rich-Harris and mrkishi committed May 23, 2022
1 parent 7d9d9c4 commit b36f65a
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 @@ -552,7 +552,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 @@ -81,7 +81,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.prerendering ? 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 @@ -173,7 +173,7 @@ export interface HandleError {
}

/**
* The `(input: LoadInput) => LoadOutput` `load` function exported from `<script context="module">` in a page or layout.
* The `(event: 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 @@ -182,10 +182,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>>;
(event: 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 b36f65a

Please sign in to comment.