fix: allow access to root-level issues in schema-less forms (#14893)
authorMatt DeKok <matt@dekok.dev>
Thu, 20 Nov 2025 19:22:11 +0000 (13:22 -0600)
committerGitHub <noreply@github.com>
Thu, 20 Nov 2025 19:22:11 +0000 (20:22 +0100)
* 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 <5968653+dummdidumm@users.noreply.github.com>
* Update types

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
.changeset/every-bears-clean.md [new file with mode: 0644]
packages/kit/src/exports/public.d.ts
packages/kit/test/types/remote.test.ts
packages/kit/types/index.d.ts

diff --git a/.changeset/every-bears-clean.md b/.changeset/every-bears-clean.md
new file mode 100644 (file)
index 0000000..8463211
--- /dev/null
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+fix: allow access to root-level issues in schema-less forms
index 21ed3e6cda0006c08a5c150a40afb94ed1921d69..5bc86276b4f524ff6b183eca0a52014a48fa13f5 100644 (file)
@@ -2075,7 +2075,7 @@ export type RemoteForm<Input extends RemoteFormInput | void, Output> = {
        /** The number of pending submissions */
        get pending(): number;
        /** Access form fields using object notation */
-       fields: Input extends void ? never : RemoteFormFields<Input>;
+       fields: RemoteFormFields<Input>;
        /** Spread this onto a `<button>` or `<input type="submit">` */
        buttonProps: {
                type: 'submit';
index 760663fa9291ddaf2253da5c84b2aa0c333c77b1..99609c6d16a98258ed24793498f8021aa2f74479 100644 (file)
@@ -341,6 +341,8 @@ function form_tests() {
                        invalid.x('bar')
                );
        });
+       f8.fields.issues();
+       f8.fields.allIssues();
        // @ts-expect-error
        f8.fields.x;
        // @ts-expect-error
index 35b387405f53fcf56aaf9e865e780f4971075fda..cf87795ed24731d665dc70b5a73c2d45ccb73523 100644 (file)
@@ -2051,7 +2051,7 @@ declare module '@sveltejs/kit' {
                /** The number of pending submissions */
                get pending(): number;
                /** Access form fields using object notation */
-               fields: Input extends void ? never : RemoteFormFields<Input>;
+               fields: RemoteFormFields<Input>;
                /** Spread this onto a `<button>` or `<input type="submit">` */
                buttonProps: {
                        type: 'submit';