Hi i've been using tuyau in adonisjs + nextjs monorepo setup, and it's been great for type safety. However i'v encountered a few friction points that, if addressed would significantly improve the DX
- Native File support in generated types
Currently, when handling multipart/form-data, the generated types for request body don't seem recognize the native DOM File object. This forces us to use double casting
// Current workaround
value={(field.state.value ?? []) as unknown as File[]}
onValueChange={(file) => field.handleChange(file as unknown as typeof field.state.value)}
- Optional baseUrl wrapping for urlFor
In monorepo setups, the frontend and backend run on different origins. Manually prepending the environment variable every time we need an asset URL is repetitive
const src = `${process.env.NEXT_PUBLIC_BASE_URL}${tuyauClient.urlFor("attachments", { key: name })}`;
Add an option in urlFor to wrap the path with the baseUrl
- Expose safe utility as a standalone export
The safe utility is excellent for avoiding try-catch blocks. However, it is currently difficult to use it for custom logic or external mutations (like wrapping a TanStack Query mutateAsync call).
const [error, success] = await safe(mutateAsync({ params, body: value }));
Originally posted by @epenflow in #100
Originally posted by @epenflow in #100