@firtoz/router-toolkit 9.0.1 → 9.0.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/README.md +4 -22
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -506,7 +506,7 @@ Type-safe form action wrapper that provides Zod validation and structured error
|
|
|
506
506
|
|
|
507
507
|
- ✅ **Automatic form data validation** using Zod schemas
|
|
508
508
|
- 🛡️ **Type-safe error handling** with structured error types
|
|
509
|
-
- 🔄 **MaybeError integration** for consistent error patterns
|
|
509
|
+
- 🔄 **MaybeError integration** for consistent error patterns — import **`success`** / **`fail`** from [`@firtoz/maybe-error`](../maybe-error/README.md), not from router-toolkit (see [MaybeError Utility](#maybeerror-utility))
|
|
510
510
|
- 🚀 **React Router compatibility** preserves redirects and responses
|
|
511
511
|
- 📝 **Full TypeScript support** with inferred types from schemas
|
|
512
512
|
|
|
@@ -1184,6 +1184,8 @@ export default function CombinedTest() {
|
|
|
1184
1184
|
|
|
1185
1185
|
`@firtoz/maybe-error` is a **dependency** of router-toolkit (it is installed with this package), but it is **not** re-exported from `@firtoz/router-toolkit`. Import `success`, `fail`, `MaybeError`, `exhaustiveGuard`, and related symbols **from `@firtoz/maybe-error`** so your imports match runtime and dependency boundaries stay clear.
|
|
1186
1186
|
|
|
1187
|
+
For the full API (`MaybeError`, `success`, `fail`, `exhaustiveGuard`, `AssumeSuccess`), see the [`@firtoz/maybe-error` README](../maybe-error/README.md).
|
|
1188
|
+
|
|
1187
1189
|
### Basic Usage
|
|
1188
1190
|
|
|
1189
1191
|
```tsx
|
|
@@ -1387,27 +1389,7 @@ export default function CreateUser() {
|
|
|
1387
1389
|
|
|
1388
1390
|
### MaybeError API Reference
|
|
1389
1391
|
|
|
1390
|
-
|
|
1391
|
-
// Type definitions
|
|
1392
|
-
type MaybeError<T = undefined, TError = string> = DefiniteSuccess<T> | DefiniteError<TError>;
|
|
1393
|
-
|
|
1394
|
-
type DefiniteSuccess<T> = {
|
|
1395
|
-
success: true;
|
|
1396
|
-
result: T; // Optional if T is undefined
|
|
1397
|
-
};
|
|
1398
|
-
|
|
1399
|
-
type DefiniteError<TError> = {
|
|
1400
|
-
success: false;
|
|
1401
|
-
error: TError;
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
// Utility functions
|
|
1405
|
-
const success = <T>(value: T): DefiniteSuccess<T> => ({ success: true, result: value });
|
|
1406
|
-
const fail = <TError>(error: TError): DefiniteError<TError> => ({ success: false, error });
|
|
1407
|
-
|
|
1408
|
-
// Type utility
|
|
1409
|
-
type AssumeSuccess<T extends MaybeError<unknown>> = /* extracts the success type */;
|
|
1410
|
-
```
|
|
1392
|
+
See [`@firtoz/maybe-error` README](../maybe-error/README.md) for type definitions and utilities.
|
|
1411
1393
|
|
|
1412
1394
|
**Benefits:**
|
|
1413
1395
|
- **Type Safety**: TypeScript enforces error handling at compile time
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firtoz/router-toolkit",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "Type-safe React Router 7 framework mode helpers with enhanced fetching, form submission, and state management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"react": "^19.2.5",
|
|
68
68
|
"react-router": "^7.14.2",
|
|
69
|
-
"zod": "^4.
|
|
69
|
+
"zod": "^4.4.2"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=18.0.0"
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@firtoz/maybe-error": "^1.6.
|
|
78
|
+
"@firtoz/maybe-error": "^1.6.2",
|
|
79
79
|
"zod-form-data": "^3.0.1"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"@types/jsdom": "^28.0.1",
|
|
84
84
|
"@types/react": "^19.2.14",
|
|
85
85
|
"bun-types": "^1.3.13",
|
|
86
|
-
"jsdom": "^29.
|
|
86
|
+
"jsdom": "^29.1.1"
|
|
87
87
|
}
|
|
88
88
|
}
|