eden-tanstack-query 0.0.6 → 0.0.7
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.ts +6 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,10 +33,14 @@ interface EdenQueryConfig<TThrowOnError extends ThrowOnErrorOption = true> {
|
|
|
33
33
|
* Narrows data type by excluding error-shaped objects when throwOnError is true.
|
|
34
34
|
* When throwOnError is true, errors are thrown before reaching callbacks like
|
|
35
35
|
* `select` or `onSuccess`, so the data type should exclude error shapes.
|
|
36
|
+
*
|
|
37
|
+
* Uses conditional type to check if each union member has an `error: string` property,
|
|
38
|
+
* which handles cases like `{ error: string; message?: undefined }` that simple
|
|
39
|
+
* `Exclude<T, { error: string }>` misses due to structural typing quirks.
|
|
36
40
|
*/
|
|
37
|
-
type NarrowedData<TData, TThrowOnError> = TThrowOnError extends true ?
|
|
41
|
+
type NarrowedData<TData, TThrowOnError> = TThrowOnError extends true ? TData extends {
|
|
38
42
|
error: string;
|
|
39
|
-
}
|
|
43
|
+
} ? never : TData : TData;
|
|
40
44
|
interface EdenOptions<TEden = unknown> {
|
|
41
45
|
eden?: TEden;
|
|
42
46
|
}
|