Than later we have error with usage of: const { error, formItemId } = useFormField().
TS2339: Property error does not exist on type
{ id: string; name: string; formItemId: string; formDescriptionId: string; formMessageId: string; }
Error in typescript brake process build for Nextjs.
Affected component/components
Form
How to reproduce
Test form component within nextjs application.
Codesandbox/StackBlitz link
No response
Logs
next build
▲ Next.js 14.2.4
- Environments: .env.local
Creating an optimized production build ...
⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
✓ Compiled successfully
Linting and checking validity of types .Failed to compile.
./src/components/ui/form.tsx:45:26
Type error: Property 'formState' does not exist on type '{ getFieldState: () => {}; getValues: () => {}; watch: () => {}; setValue: () => {}; register: () => {}; }'.
43 | const fieldContext = React.useContext(FormFieldContext)
44 | const itemContext = React.useContext(FormItemContext)
> 45 | const { getFieldState, formState } = useFormContext()
| ^
46 |
47 | const fieldState = getFieldState(fieldContext.name, formState)
48 |
ELIFECYCLE Command failed with exit code 1.
System Info
Linux Mint, nodejs v22.11.0, nextjs 14.2.4
Before submitting
[X] I've made research efforts and searched the documentation
Describe the bug
There is typescript errors within form component.
Property formState does not exist in useFormContext.
Than for part
const fieldState = getFieldState(fieldContext.name, formState)
getFieldState expect no arguments.
Than later we have error with usage of:
const { error, formItemId } = useFormField()
.TS2339: Property error does not exist on type { id: string; name: string; formItemId: string; formDescriptionId: string; formMessageId: string; }
Error in typescript brake process build for Nextjs.
Affected component/components
Form
How to reproduce
Test form component within nextjs application.
Codesandbox/StackBlitz link
No response
Logs
System Info
Before submitting