@firtoz/router-toolkit 3.0.3 → 3.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firtoz/router-toolkit",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "Type-safe React Router 7 framework mode helpers with enhanced fetching, form submission, and state management",
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -26,7 +26,7 @@
26
26
  "README.md"
27
27
  ],
28
28
  "scripts": {
29
- "typecheck": "tsc --noEmit",
29
+ "typecheck": "tsc --noEmit -p ./tsconfig.json",
30
30
  "lint": "biome check --write src",
31
31
  "lint:ci": "biome ci src",
32
32
  "format": "biome format src --write",
package/src/formAction.ts CHANGED
@@ -34,10 +34,10 @@ import { zfd } from "zod-form-data";
34
34
  /**
35
35
  * Error types that can be returned by formAction
36
36
  */
37
- export type FormActionError<TError> =
37
+ export type FormActionError<TError, TSchema extends z.ZodTypeAny> =
38
38
  | {
39
39
  type: "validation";
40
- error: ReturnType<typeof z.treeifyError<z.ZodTypeAny>>;
40
+ error: ReturnType<typeof z.treeifyError<TSchema>>;
41
41
  }
42
42
  | {
43
43
  type: "handler";
@@ -150,7 +150,7 @@ export const formAction = <
150
150
  }: FormActionConfig<TSchema, TResult, TError, ActionArgs>) => {
151
151
  return async (
152
152
  args: ActionArgs,
153
- ): Promise<MaybeError<TResult, FormActionError<TError>>> => {
153
+ ): Promise<MaybeError<TResult, FormActionError<TError, TSchema>>> => {
154
154
  try {
155
155
  const rawFormData = await args.request.formData();
156
156
  const formData = await zfd.formData(schema).safeParseAsync(rawFormData);