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;