Skip to content

rename LoadInput to LoadEvent #5015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 `(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 @@ -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>>;
(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