Skip to content

Commit

Permalink
fix: SearchParams check
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Oct 20, 2023
1 parent eba9684 commit f871bb2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-crabs-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"remix-routes": patch
---

fix SearchParams check
20 changes: 6 additions & 14 deletions packages/remix-routes/src/__tests__/__snapshots__/cli.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

exports[`build v1 routes 1`] = `
"declare module \\"remix-routes\\" {
type IsAny<T> = (
unknown extends T
? [keyof T] extends [never] ? false : true
: false
);
type URLSearchParamsInit = string | string[][] | Record<string, string> | URLSearchParams;
type ExportedQuery<T> = IsAny<T> extends true ? URLSearchParamsInit : T;
type Query<T> = IsAny<T> extends true ? [URLSearchParamsInit?] : [T];
// symbol won't be a key of SearchParams
type IsSearchParams<T> = symbol extends keyof T ? false : true;
type ExportedQuery<T> = IsSearchParams<T> extends true ? T : URLSearchParamsInit;
export interface Routes {
Expand Down Expand Up @@ -230,14 +226,10 @@ exports[`build v1 routes 1`] = `
exports[`build v2 routes 1`] = `
"declare module \\"remix-routes\\" {
type IsAny<T> = (
unknown extends T
? [keyof T] extends [never] ? false : true
: false
);
type URLSearchParamsInit = string | string[][] | Record<string, string> | URLSearchParams;
type ExportedQuery<T> = IsAny<T> extends true ? URLSearchParamsInit : T;
type Query<T> = IsAny<T> extends true ? [URLSearchParamsInit?] : [T];
// symbol won't be a key of SearchParams
type IsSearchParams<T> = symbol extends keyof T ? false : true;
type ExportedQuery<T> = IsSearchParams<T> extends true ? T : URLSearchParamsInit;
export interface Routes {
Expand Down
10 changes: 3 additions & 7 deletions packages/remix-routes/src/template.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
export const template = `declare module "remix-routes" {
type IsAny<T> = (
unknown extends T
? [keyof T] extends [never] ? false : true
: false
);
type URLSearchParamsInit = string | string[][] | Record<string, string> | URLSearchParams;
type ExportedQuery<T> = IsAny<T> extends true ? URLSearchParamsInit : T;
type Query<T> = IsAny<T> extends true ? [URLSearchParamsInit?] : [T];
// symbol won't be a key of SearchParams
type IsSearchParams<T> = symbol extends keyof T ? false : true;
type ExportedQuery<T> = IsSearchParams<T> extends true ? T : URLSearchParamsInit;
export interface Routes {
<% routes.forEach(({ route, params, fileName }) => { %>
Expand Down

0 comments on commit f871bb2

Please sign in to comment.