Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/engine/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type AbstractQueryValueElement =
| boolean
| Date
| bigint
| null

export type AbstractQuery = Record<
string,
Expand Down Expand Up @@ -54,7 +55,7 @@ export type AbstractQueryOptions = {
/**
* How the abstract query is converted to an actual query.
*
* @default Each value that is not undefined is converted to a string by calling `.toString()`.
* @default Each value that is not undefined and is converted to a string. `null` is converted to an empty string, while other values are converted calling `String(value)`.
*/
convertToQuery: (abstractQuery: Partial<AbstractQuery>) => Query
}
Expand All @@ -64,7 +65,7 @@ const DEFAULT_ABSTRACT_QUERY_OPTIONS: AbstractQueryOptions = {
const query: Query = {}
for (const [key, value] of Object.entries(abstractQuery)) {
if (value !== undefined) {
query[key] = value.toString()
query[key] = value === null ? '' : String(value)
}
}
return query
Expand Down
3 changes: 1 addition & 2 deletions src/routers/__test__/nextRouter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { expectTypeOf, vi } from 'vitest'
import { useQuery, useQueryAndPagination } from '../../zod/routers/nextRouter'
import { usePagination } from '../nextRouter'

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
vi.mock('next/router', () => require('next-router-mock'))
vi.mock('next/router', async () => await import('next-router-mock'))

describe('NextRouter', () => {
beforeEach(() => {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@aboutbits/ts-config/react",
"compilerOptions": {
"module": "es2020",
"moduleResolution": "node",
"skipLibCheck": true
},
Expand Down