Skip to content

Commit

Permalink
fix: fix the type
Browse files Browse the repository at this point in the history
  • Loading branch information
guesung committed Nov 21, 2024
1 parent 805ed41 commit 017c704
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions apps/www/registry/default/ui/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const useFormField = () => {

const fieldState = getFieldState(fieldContext.name, formState)

if (!fieldContext) {
if (!fieldContext || !itemContext) {
throw new Error("useFormField should be used within <FormField>")
}

Expand All @@ -68,9 +68,7 @@ type FormItemContextValue = {
id: string
}

const FormItemContext = React.createContext<FormItemContextValue>(
{} as FormItemContextValue
)
const FormItemContext = React.createContext<FormItemContextValue | null>(null)

const FormItem = React.forwardRef<
HTMLDivElement,
Expand Down

0 comments on commit 017c704

Please sign in to comment.