custom reusable form.Field component, trying to use Form Composition
However... The name prop shows
Type 'string' is not assignable to type 'never'.ts(2322), and state is never too. Am I doing something wrong?Type 'string' is not assignable to type 'never'.ts(2322)neverimport type { ZodObject, ZodRawShape } from "zod";
import LabeledField from "@/components/form/labeled-field";
import { isFieldRequired, useFormContext } from "@/components/form/utils";
import { Input } from "@/components/ui/input";
interface FieldInputProps {
id: string;
fieldName: string;
label: string;
schema: ZodObject<ZodRawShape>;
}
export default function FieldInput({ id, fieldName, label, schema }: FieldInputProps) {
const form = useFormContext();
return (
<form.Field
name={fieldName}
children={({ state, handleChange, handleBlur }) => (
<LabeledField labelFor={id} label={label} required={isFieldRequired(fieldName, schema)}>
<Input id={id} value={state.value ?? ""} onChange={(e) => handleChange(e.target.value)} onBlur={handleBlur} />
</LabeledField>
)}
/>
);
}You can now submit your website/app/project to http://TanStack.com 's new showcase and have it seen by the TanStack community! - Global showcase browser - Per-library filters - Category filters Submit here: https://tanstack.com/showcase/submit View all here: https://tanstack.com/showcase
dry-scarlet · 2w ago
TanStack AI Alpha 2 is here! 🖼️ Image, video, audio, speech, transcription, structured output 📦 Split adapters = smaller bundles, faster dev/contributions, easier 🎄 Fully tree shakable adapters ✨ Cleaner, flattened, fully type-safe APIs https://tanstack.com/blog/tanstack-ai-alpha-2
dry-scarlet · 4w ago
📣 TanStack AI Alpha is here! ✨ Framework agnostic 🤖 Provider agnostic 🧠 Type safe 🔧 Isomorphic tools 🛠 Devtools 🌐 Open protocol 📦 JS, Python, PHP ⚛️ React, Solid, Vanilla 🌀 OpenAI, Anthropic, Gemini, Ollama, ++ Official blog post: https://tanstack.com/blog/tanstack-ai-alpha-your-ai-your-way Docs: https://tanstack.com/ai
dry-scarlet · 2mo ago