Skip to content

Commit 456e5ee

Browse files
AndaristTkDodo
andauthored
feat(types): cheaper WithRequired (#4922)
* feat(types): cheaper `WithRequired` * fix(types): intersect with `{}` (`NonNullable`-style) instead of `unknown` in `WithRequired` --------- Co-authored-by: Dominik Dorfmeister <[email protected]>
1 parent 684ed14 commit 456e5ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/query-core/src/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ export interface QueryObserverOptions<
263263
_optimisticResults?: 'optimistic' | 'isRestoring'
264264
}
265265

266-
export type WithRequired<T, K extends keyof T> = Omit<T, K> &
267-
Required<Pick<T, K>>
266+
export type WithRequired<T, K extends keyof T> = T & { [_ in K]: {} }
267+
268268
export type DefaultedQueryObserverOptions<
269269
TQueryFnData = unknown,
270270
TError = unknown,

0 commit comments

Comments
 (0)