Skip to content

Commit c11c33c

Browse files
committed
Added exports for implementation convenience.
1 parent 5041414 commit c11c33c

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Added
11+
12+
- Exported `SuperFormData` and `SuperFormErrors` types for superForm.
13+
- Exported `ZodObjectTypes` and `ZodValidation` types for the Zod adapter.
14+
1015
### Fixed
1116

1217
- Using [setError](https://superforms.rocks/concepts/error-handling#seterror) in the load function and navigating to the same page client-side removed the errors.

src/lib/adapters/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export { superformClient } from './superform.js';
66
export { typebox, typeboxClient } from './typebox.js';
77
export { valibot, valibotClient } from './valibot.js';
88
export { yup, yupClient } from './yup.js';
9-
export { zod, zodClient } from './zod.js';
9+
export { zod, zodClient, type ZodValidation, type ZodObjectTypes } from './zod.js';
1010
export { vine, vineClient } from './vine.js';
1111
export { schemasafe, schemasafeClient } from './schemasafe.js';
1212
export { superstruct, superstructClient } from './superstruct.js';

src/lib/adapters/zod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type ZodObjectUnion<T extends AnyZodObject> = ZodUnion<
3838

3939
type ZodObjectType = ZodType<Record<string, unknown>, ZodTypeDef, Record<string, unknown>>;
4040

41-
type ZodObjectTypes = AnyZodObject | ZodObjectUnion<AnyZodObject> | ZodObjectType;
41+
export type ZodObjectTypes = AnyZodObject | ZodObjectUnion<AnyZodObject> | ZodObjectType;
4242

4343
export type ZodValidation<T extends ZodObjectTypes> =
4444
| T

src/lib/client/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export type {
4949
FormResult,
5050
FormOptions,
5151
SuperForm,
52+
SuperFormData,
53+
SuperFormErrors,
5254
SuperFormEventList,
5355
SuperFormEvents,
5456
SuperFormSnapshot,

src/lib/client/superForm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ export type SuperFormSnapshot<
191191
In extends Record<string, unknown> = T
192192
> = SuperFormValidated<T, M, In> & { tainted: TaintedFields<T> | undefined };
193193

194-
type SuperFormData<T extends Record<string, unknown>> = {
194+
export type SuperFormData<T extends Record<string, unknown>> = {
195195
subscribe: Readable<T>['subscribe'];
196196
set(this: void, value: T, options?: { taint?: TaintOption }): void;
197197
update(this: void, updater: Updater<T>, options?: { taint?: TaintOption }): void;
198198
};
199199

200-
type SuperFormErrors<T extends Record<string, unknown>> = {
200+
export type SuperFormErrors<T extends Record<string, unknown>> = {
201201
subscribe: Writable<ValidationErrors<T>>['subscribe'];
202202
set(this: void, value: ValidationErrors<T>, options?: { force?: boolean }): void;
203203
update(this: void, updater: Updater<ValidationErrors<T>>, options?: { force?: boolean }): void;

0 commit comments

Comments
 (0)