@emeryld/rrroutes-client 2.8.1 → 2.8.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 +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/routesV3.client.batch.d.ts +2 -2
- package/dist/routesV3.client.d.ts +3 -3
- package/dist/routesV3.client.get.d.ts +2 -2
- package/dist/routesV3.client.infiniteGet.d.ts +2 -2
- package/dist/routesV3.client.mutation.d.ts +2 -2
- package/dist/routesV3.client.types.d.ts +33 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,12 +85,20 @@ const client = createRouteClient({
|
|
|
85
85
|
})
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
If you want a typed client-wide hook error
|
|
88
|
+
If you want a typed client-wide hook error without passing generics everywhere, augment the global RRRoutes client register once:
|
|
89
89
|
|
|
90
90
|
```ts
|
|
91
91
|
import { createRouteClient, type HttpError } from '@emeryld/rrroutes-client'
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
declare global {
|
|
94
|
+
namespace RRRoutesClient {
|
|
95
|
+
interface Register {
|
|
96
|
+
error: HttpError
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const client = createRouteClient({
|
|
94
102
|
baseUrl: 'https://api.example.com',
|
|
95
103
|
queryClient,
|
|
96
104
|
})
|
|
@@ -100,6 +108,8 @@ const result = users.useEndpoint()
|
|
|
100
108
|
// result.error is now typed as HttpError | null
|
|
101
109
|
```
|
|
102
110
|
|
|
111
|
+
You can still override per-client by passing `createRouteClient<Names, TError>(...)` when needed.
|
|
112
|
+
|
|
103
113
|
### 2) Build endpoints from your registry
|
|
104
114
|
|
|
105
115
|
```ts
|