diff --git a/.changeset/twenty-papers-unite.md b/.changeset/twenty-papers-unite.md new file mode 100644 index 000000000000..cdbcf6036453 --- /dev/null +++ b/.changeset/twenty-papers-unite.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: delete `RemoteFormAllIssue`, add `path` to `RemoteFormIssue` diff --git a/packages/kit/src/exports/public.d.ts b/packages/kit/src/exports/public.d.ts index 1ef333310326..3516689dce67 100644 --- a/packages/kit/src/exports/public.d.ts +++ b/packages/kit/src/exports/public.d.ts @@ -1911,12 +1911,12 @@ export type RemoteFormField = RemoteFormFiel type RemoteFormFieldContainer = RemoteFormFieldMethods & { /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormAllIssue[] | undefined; + allIssues(): RemoteFormIssue[] | undefined; }; type UnknownField = RemoteFormFieldMethods & { /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormAllIssue[] | undefined; + allIssues(): RemoteFormIssue[] | undefined; /** * Returns an object that can be spread onto an input element with the correct type attribute, * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters. @@ -1963,9 +1963,6 @@ export interface RemoteFormInput { export interface RemoteFormIssue { message: string; -} - -export interface RemoteFormAllIssue extends RemoteFormIssue { path: Array; } diff --git a/packages/kit/src/runtime/form-utils.js b/packages/kit/src/runtime/form-utils.js index 26468a4dd005..c879fa2be5e2 100644 --- a/packages/kit/src/runtime/form-utils.js +++ b/packages/kit/src/runtime/form-utils.js @@ -255,6 +255,7 @@ export function create_field_proxy(target, get_input, set_input, get_issues, pat return all_issues ?.filter((issue) => issue.name === key) ?.map((issue) => ({ + path: issue.path, message: issue.message })); }; diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index 9705e4a0b9bd..0ddf7ca08844 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -1887,12 +1887,12 @@ declare module '@sveltejs/kit' { type RemoteFormFieldContainer = RemoteFormFieldMethods & { /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormAllIssue[] | undefined; + allIssues(): RemoteFormIssue[] | undefined; }; type UnknownField = RemoteFormFieldMethods & { /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormAllIssue[] | undefined; + allIssues(): RemoteFormIssue[] | undefined; /** * Returns an object that can be spread onto an input element with the correct type attribute, * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters. @@ -1939,9 +1939,6 @@ declare module '@sveltejs/kit' { export interface RemoteFormIssue { message: string; - } - - export interface RemoteFormAllIssue extends RemoteFormIssue { path: Array; }