Skip to content

Commit 2ff3951

Browse files
sillvvadummdidumm
andauthored
fix: allow access to root-level issues in schema-less forms (#14893)
* fix: allow access to root-level issues in schema-less forms * feat: use IsAny type to account for `f7` test * include `allIssues()` * simplify type Co-authored-by: Simon H <[email protected]> * Update types --------- Co-authored-by: Simon H <[email protected]>
1 parent fa32cc0 commit 2ff3951

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

.changeset/every-bears-clean.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+
fix: allow access to root-level issues in schema-less forms

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ export type RemoteForm<Input extends RemoteFormInput | void, Output> = {
20752075
/** The number of pending submissions */
20762076
get pending(): number;
20772077
/** Access form fields using object notation */
2078-
fields: Input extends void ? never : RemoteFormFields<Input>;
2078+
fields: RemoteFormFields<Input>;
20792079
/** Spread this onto a `<button>` or `<input type="submit">` */
20802080
buttonProps: {
20812081
type: 'submit';

packages/kit/test/types/remote.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ function form_tests() {
341341
invalid.x('bar')
342342
);
343343
});
344+
f8.fields.issues();
345+
f8.fields.allIssues();
344346
// @ts-expect-error
345347
f8.fields.x;
346348
// @ts-expect-error

packages/kit/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,7 @@ declare module '@sveltejs/kit' {
20512051
/** The number of pending submissions */
20522052
get pending(): number;
20532053
/** Access form fields using object notation */
2054-
fields: Input extends void ? never : RemoteFormFields<Input>;
2054+
fields: RemoteFormFields<Input>;
20552055
/** Spread this onto a `<button>` or `<input type="submit">` */
20562056
buttonProps: {
20572057
type: 'submit';

0 commit comments

Comments
 (0)