diff --git a/.changeset/every-bears-clean.md b/.changeset/every-bears-clean.md new file mode 100644 index 000000000000..846321177a2d --- /dev/null +++ b/.changeset/every-bears-clean.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: allow access to root-level issues in schema-less forms diff --git a/packages/kit/src/exports/public.d.ts b/packages/kit/src/exports/public.d.ts index 3516689dce67..bfd1279cbfb1 100644 --- a/packages/kit/src/exports/public.d.ts +++ b/packages/kit/src/exports/public.d.ts @@ -6,6 +6,7 @@ import { AdapterEntry, CspDirectives, HttpMethod, + IsAny, Logger, MaybePromise, Prerendered, @@ -2058,7 +2059,16 @@ export type RemoteForm = { /** The number of pending submissions */ get pending(): number; /** Access form fields using object notation */ - fields: Input extends void ? never : RemoteFormFields; + fields: IsAny extends true + ? RecursiveFormFields + : Input extends void + ? { + /** Validation issues, if any */ + issues(): RemoteFormIssue[] | undefined; + /** Validation issues belonging to this or any of the fields that belong to it, if any */ + allIssues(): RemoteFormIssue[] | undefined; + } + : RemoteFormFields; /** Spread this onto a `