Skip to content

Commit 2182c81

Browse files
committed
Added focusOnError to SuperForm type
1 parent b6c30a2 commit 2182c81

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Headlines: Added, Changed, Deprecated, Removed, Fixed, Security
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Fixed
11+
12+
- Added `focusOnError` option to `SuperForm.validateForm` type (it was only in the implementation).
13+
814
## [2.2.0] - 2024-02-15
915

1016
### Added

src/lib/client/superForm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ export type SuperForm<
235235
>(opts?: {
236236
update?: boolean;
237237
schema?: ValidationAdapter<Out, In>;
238+
focusOnError?: boolean;
238239
}) => Promise<SuperFormValidated<T, M, In>>;
239240
};
240241

src/tests/errors.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,13 @@ describe('Mapping defaults to invalid data', () => {
110110
});
111111
});
112112
});
113+
114+
describe('The ValidationErrors type', () => {
115+
it('should work as expected', () => {
116+
const data = { name: '' };
117+
const name = 'name' as keyof typeof data;
118+
const errors: ValidationErrors<typeof data> = {};
119+
const test: string[] = errors[name] ?? [];
120+
expect(test).toEqual([]);
121+
});
122+
});

0 commit comments

Comments
 (0)