export user-friendly type definition for HookSafeActionFn and similars #294
aleclofabbro
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
useHookFormAction
needs to be passed a server action, typically created with proper factories ( e.g.createSafeActionClient(...).schema(...).action(...)
)that works just fine when directly importing the server action in a client component.
However, I wonder how to define a
safeActon
property of a client component usinguseHookFormAction
in a more agnostic scenario (e.g. a component library) where, for instance only the input schema, and return type is knownAt the moment I defined a utility type as
so that I can define safe-action properties as simple as
I see that
HookSafeActionFn
and relatedSafeActionResult
have many generics, and can't understand the meaning and purpose of all of them, and my solution solves a very narrow use-case (that's enough for me, so far at least ...)It would be very handy to have
next-safe-action
library to export various utility types to easily define safe-action types in different flavours, for component consumptionBeta Was this translation helpful? Give feedback.
All reactions