From 8509bdb76f2e79bd3de980744b5773bcc2608c29 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Wed, 5 Nov 2025 22:00:10 -0800 Subject: [PATCH] fix(tanstack): extra optimistic typing fix --- .../clients/tanstack-query/src/utils/types.ts | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/clients/tanstack-query/src/utils/types.ts b/packages/clients/tanstack-query/src/utils/types.ts index 7a5f32ef..b6616588 100644 --- a/packages/clients/tanstack-query/src/utils/types.ts +++ b/packages/clients/tanstack-query/src/utils/types.ts @@ -31,19 +31,13 @@ export type TrimDelegateModelOperations< T extends Record, > = IsDelegateModel extends true ? Omit : T; -export type WithOptimistic = - T extends Array - ? Array< - U & { - /** - * Indicates if the item is in an optimistic update state - */ - $optimistic?: boolean; - } - > - : T & { - /** - * Indicates if the item is in an optimistic update state - */ - $optimistic?: boolean; - }; +type WithOptimisticFlag = T extends object + ? T & { + /** + * Indicates if the item is in an optimistic update state + */ + $optimistic?: boolean; + } + : T; + +export type WithOptimistic = T extends Array ? Array> : WithOptimisticFlag;