Skip to content

Commit

Permalink
fix: change undefined check for searchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemorales committed Feb 1, 2024
1 parent d73ebdf commit 40fae4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/create-navigation-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ type SafeRoute<Params extends z.ZodSchema, Search extends z.ZodSchema> =
[Params, Search] extends [never, never] ? SafeRootRoute
: [Params, Search] extends [z.ZodSchema, never] ? SafeRouteWithParams<Params>
: [Params, Search] extends [never, z.ZodSchema] ?
Search extends z.ZodOptional<any> ?
undefined extends z.input<Search> ?
SafeRouteWithSearch<Search>
: SafeRouteWithRequiredSearch<Search>
: [Params, Search] extends [z.ZodSchema, z.ZodSchema] ?
Search extends z.ZodOptional<any> ?
undefined extends z.input<Search> ?
SafeRouteWithParamsAndSearch<Params, Search>
: SafeRouteWithParamsAndRequiredSearch<Params, Search>
: never;
Expand Down
4 changes: 2 additions & 2 deletions src/make-route-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type RouteBuilder<
getSchemas: () => { params: Params; search: never };
}
: [Params, Search] extends [never, z.ZodSchema] ?
Search extends z.ZodOptional<any> ?
undefined extends z.input<Search> ?
{
(options?: { search?: z.input<Search> }): string;
getSchemas: () => { params: never; search: Search };
Expand All @@ -31,7 +31,7 @@ export type RouteBuilder<
getSchemas: () => { params: never; search: Search };
}
: [Params, Search] extends [z.ZodSchema, z.ZodSchema] ?
Search extends z.ZodOptional<any> ?
undefined extends z.input<Search> ?
{
(options: z.input<Params> & { search?: z.input<Search> }): string;
getSchemas: () => { params: Params; search: Search };
Expand Down

0 comments on commit 40fae4e

Please sign in to comment.