Skip to content

Commit

Permalink
chore: export types and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Mar 18, 2024
1 parent f9a49ff commit f612380
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ export {
useMutation,
type UseMutationReturn,
type UseMutationOptions,
type _ReduceContext,
type _EmptyObject,
} from './use-mutation'
export { useQuery, type UseQueryReturn } from './use-query'

// export { type UseQueryKeyList } from './query-keys'

export {
// TODO: figure out if worth
// TODO: figure out if worth compared to `defineQuery()`
// queryOptions,
// type InferUseQueryKeyData,
type UseQueryKey,
Expand All @@ -27,7 +29,11 @@ export {

export { TreeMapNode, type EntryNodeKey } from './tree-map'

export { delayLoadingRef } from './utils'
export {
delayLoadingRef,
type _MaybeArray,
type _Awaitable,
} from './utils'

export type { TypesConfig } from './types-extension'

Expand Down
8 changes: 8 additions & 0 deletions src/use-mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ type _MutationKeys<TVars, TResult> =
| UseQueryKey[]
| ((data: TResult, vars: TVars) => UseQueryKey[])

/**
* To avoid using `{}`
* @internal
*/
export interface _EmptyObject {}

/**
* Removes the nullish types from the context type to make `A & TContext` work instead of yield `never`.
* @internal
*/
export type _ReduceContext<TContext> = TContext extends void | null | undefined
? _EmptyObject
: TContext
Expand Down

0 comments on commit f612380

Please sign in to comment.