trpc-typed-form-data
Installation
SKILL.md
@falcondev-oss/trpc-typed-form-data
tRPC can't type a FormData input: files must ride as multipart parts, everything else is untyped strings, and input arrives undefined. This package restores end-to-end type safety by carrying the non-file fields as a serialized sidecar — a JSON blob in one extra FormData field (~data) — while files stay as real multipart parts. Client, server, and schema each handle one half of that trick.
Four entry points:
| Import from | Gives you |
|---|---|
.../client |
createTypedFormData, typedFormDataLink, ReactNativeFile |
.../server |
typedFormData, createTypedFormDataPlugin |
.../zod |
zod-native file() validator (nest in z.object) |
. (root) |
file (Standard Schema), isFile, types — the framework-agnostic subset |
file, isFile, and the types (FileValue, FileValidationOptions, TypedFormData) are re-exported from /client and /server too, so import them from wherever you already are.
Three touch points — all required
The sidecar only works if every piece is wired. Miss one and validation throws a message naming what's missing.