Skip to content

Commit 76d7fcf

Browse files
author
devgioele
authored
Merge pull request #20 from aboutbits/fix-default-query-type-zod-routers
Fix type of default query
2 parents 909ad72 + f45fd9a commit 76d7fcf

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/zod/routers/inMemory.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import { zodParser } from '../util'
99
export const useQuery = <
1010
TSchema extends z.ZodTypeAny,
1111
TQuery extends z.output<TSchema>,
12+
TDefaultQuery extends Partial<TQuery>,
1213
>(
1314
schemaQuery: TSchema,
14-
defaultQuery: Partial<TQuery> = {},
15+
defaultQuery?: TDefaultQuery,
1516
options?: Partial<AbstractQueryOptions>,
1617
) =>
1718
useQueryVanilla(
@@ -23,9 +24,10 @@ export const useQuery = <
2324
export const useQueryAndPagination = <
2425
TSchema extends z.ZodTypeAny,
2526
TQuery extends z.output<TSchema>,
27+
TDefaultQuery extends Partial<TQuery>,
2628
>(
2729
schemaQuery: TSchema,
28-
defaultQuery: Partial<TQuery> = {},
30+
defaultQuery?: TDefaultQuery,
2931
defaultPagination?: Partial<PaginationQuery>,
3032
options?: Partial<AbstractQueryOptions>,
3133
) =>

src/zod/routers/reactRouter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import { RouterWithHistoryOptions } from '../../routers/shared'
1010
export const useQuery = <
1111
TSchema extends z.ZodTypeAny,
1212
TQuery extends z.output<TSchema>,
13+
TDefaultQuery extends Partial<TQuery>,
1314
>(
1415
schemaQuery: TSchema,
15-
defaultQuery: Partial<TQuery> = {},
16+
defaultQuery?: TDefaultQuery,
1617
options?: Partial<AbstractQueryOptions & RouterWithHistoryOptions>,
1718
) =>
1819
useQueryVanilla(
@@ -24,9 +25,10 @@ export const useQuery = <
2425
export const useQueryAndPagination = <
2526
TSchema extends z.ZodTypeAny,
2627
TQuery extends z.output<TSchema>,
28+
TDefaultQuery extends Partial<TQuery>,
2729
>(
2830
schemaQuery: TSchema,
29-
defaultQuery: Partial<TQuery> = {},
31+
defaultQuery?: TDefaultQuery,
3032
defaultPagination?: Partial<PaginationQuery>,
3133
options?: Partial<AbstractQueryOptions & RouterWithHistoryOptions>,
3234
) =>

0 commit comments

Comments
 (0)