Skip to content

Commit

Permalink
Merge pull request #42 from stevent-team/fix/export-field-chain
Browse files Browse the repository at this point in the history
Reexport the FieldChain type
  • Loading branch information
GRA0007 committed Aug 18, 2023
2 parents ffcee4e + 6f9613c commit d24dfaa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-hairs-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stevent-team/react-zoom-form": patch
---

Export FieldChain helper type from the lib
1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './useForm'
export * from './field'
export * from './Errors'
export type { FieldChain } from './utils'
4 changes: 4 additions & 0 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ type RecursiveFieldChain<Schema extends z.ZodType, LeafValue> =
: Schema extends z.ZodPipeline<AnyZodContainer, AnyZodContainer> ? FieldChain<Schema, Schema['_def']['out']>
: LeafValue

/**
* Provides the type of the `fields` object from the `useForm` hook.
* You can use this if you intend to pass `fields` down through components to build a nested form.
*/
export type FieldChain<Schema extends z.ZodType, InnerSchema extends z.ZodType = Schema> = Field<Schema> & Required<RecursiveFieldChain<InnerSchema, {
/**
* Provides props to pass to native elements (input, textarea, select)
Expand Down

0 comments on commit d24dfaa

Please sign in to comment.