Skip to content

Commit

Permalink
Merge pull request #163 from Jimmyzm/main
Browse files Browse the repository at this point in the history
fix: add generic parameter to fix type error when using `default` option
  • Loading branch information
wobsoriano authored Mar 15, 2024
2 parents ba960c6 + 2d2834a commit f61d55f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,35 @@ export type DecorateProcedure<
DataE = TRPCClientErrorLike<TProcedure>,
DataT = ResT,
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
DefaultT = null,
>(
input: MaybeRefOrGetter<inferProcedureInput<TProcedure>>,
opts?: AsyncDataOptions<ResT, DataT, PickKeys> & {
opts?: AsyncDataOptions<ResT, DataT, PickKeys, DefaultT> & {
trpc?: TRPCRequestOptions
/**
* The custom unique key to use.
* @see https://nuxt.com/docs/api/composables/use-async-data#params
*/
queryKey?: string
},
) => AsyncData<PickFrom<DataT, PickKeys> | null, DataE>,
) => AsyncData<PickFrom<DataT, PickKeys> | DefaultT, DataE>,
useLazyQuery: <
ResT = inferTransformedProcedureOutput<TProcedure>,
DataE = TRPCClientErrorLike<TProcedure>,
DataT = ResT,
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
DefaultT = null,
>(
input: MaybeRefOrGetter<inferProcedureInput<TProcedure>>,
opts?: Omit<AsyncDataOptions<ResT, DataT, PickKeys>, 'lazy'> & {
opts?: Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'lazy'> & {
trpc?: TRPCRequestOptions
/**
* The custom unique key to use.
* @see https://nuxt.com/docs/api/composables/use-async-data#params
*/
queryKey?: string
},
) => AsyncData<PickFrom<DataT, PickKeys> | null, DataE>,
) => AsyncData<PickFrom<DataT, PickKeys> | DefaultT, DataE>,
query: Resolver<TProcedure>
} : TProcedure extends AnyMutationProcedure ? {
mutate: Resolver<TProcedure>
Expand All @@ -95,11 +97,12 @@ export type DecorateProcedure<
DataE = TRPCClientErrorLike<TProcedure>,
DataT = ResT,
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
DefaultT = null,
>(
opts?: Omit<AsyncDataOptions<ResT, DataT, PickKeys>, 'lazy'> & {
opts?: Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'lazy'> & {
trpc?: TRPCRequestOptions
},
) => AsyncData<PickFrom<DataT, PickKeys> | null, DataE> & {
) => AsyncData<PickFrom<DataT, PickKeys> | DefaultT, DataE> & {
/**
* The function to call to trigger the mutation.
*/
Expand Down

0 comments on commit f61d55f

Please sign in to comment.