@omer-x/next-form-actions 2.0.0-alpha.1 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -48,8 +48,11 @@ type FormActionState<Data = undefined> = IdleState | SuccessState<Data> | Failur
|
|
|
48
48
|
/**
|
|
49
49
|
* A form action, as returned by `defineFormAction`. With its extra arguments bound
|
|
50
50
|
* (e.g. `action.bind(null, id)`), it becomes a `FormAction<Data>` that `useActionState` accepts.
|
|
51
|
+
*
|
|
52
|
+
* The action never reads `previousState`, so it is typed as `unknown`. That keeps `Data` only
|
|
53
|
+
* in the return type, so `FormAction<unknown>` accepts any form action.
|
|
51
54
|
*/
|
|
52
|
-
type FormAction<Data = undefined, Args extends unknown[] = []> = (...params: [...Args, previousState:
|
|
55
|
+
type FormAction<Data = undefined, Args extends unknown[] = []> = (...params: [...Args, previousState: unknown, formData: FormData]) => Promise<FormActionState<Data>>;
|
|
53
56
|
/**
|
|
54
57
|
* Describes the definition of a type-safe server action for forms.
|
|
55
58
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omer-x/next-form-actions",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"description": "Provides helper functions to define a type-safe React server action for forms, validating form data with Zod and handling errors internally.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|