Skip to content

Commit

Permalink
feat(types): cheaper WithRequired (#4922)
Browse files Browse the repository at this point in the history
* feat(types): cheaper `WithRequired`

* fix(types): intersect with `{}` (`NonNullable`-style) instead of `unknown` in `WithRequired`

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
  • Loading branch information
Andarist and TkDodo authored Jul 21, 2023
1 parent 684ed14 commit 456e5ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/query-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ export interface QueryObserverOptions<
_optimisticResults?: 'optimistic' | 'isRestoring'
}

export type WithRequired<T, K extends keyof T> = Omit<T, K> &
Required<Pick<T, K>>
export type WithRequired<T, K extends keyof T> = T & { [_ in K]: {} }

export type DefaultedQueryObserverOptions<
TQueryFnData = unknown,
TError = unknown,
Expand Down

0 comments on commit 456e5ee

Please sign in to comment.