Skip to content

Commit fbbfe10

Browse files
committed
fix: change enhance function return type to void | Promise<void>
Closes #15700
1 parent 098acac commit fbbfe10

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

.changeset/gold-carrots-guess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
Change enhance function return type to void | Promise<void>.

packages/kit/src/exports/public.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ export type RemoteForm<Input extends RemoteFormInput | void, Output> = {
20952095
submit: () => Promise<boolean> & {
20962096
updates: (...updates: RemoteQueryUpdate[]) => Promise<boolean>;
20972097
};
2098-
}) => void
2098+
}) => void | Promise<void>
20992099
): {
21002100
method: 'POST';
21012101
action: string;

packages/kit/test/apps/async/src/routes/remote/form/for-duplicate/+page.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
<p id="count">{count.current}</p>
77

88
<!-- this looks weird but forces the spread into being reactive -->
9-
<form {...increment.for((count.current || 1) && 'a').enhance(async ({ submit }) => await submit())}>
9+
<form
10+
{...increment.for((count.current || 1) && 'a').enhance(async ({ submit }) => {
11+
await submit();
12+
})}
13+
>
1014
<button type="submit" id="submit">Submit</button>
1115
</form>

packages/kit/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ declare module '@sveltejs/kit' {
20692069
submit: () => Promise<boolean> & {
20702070
updates: (...updates: RemoteQueryUpdate[]) => Promise<boolean>;
20712071
};
2072-
}) => void
2072+
}) => void | Promise<void>
20732073
): {
20742074
method: 'POST';
20752075
action: string;

0 commit comments

Comments
 (0)