Skip to content

Commit e8c973d

Browse files
author
devgioele
committed
revert "Merge pull request #17 from aboutbits/null-value"
This reverts commit 430fa0d, reversing changes made to e2b3112.
1 parent 8c07580 commit e8c973d

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/engine/query.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export type AbstractQueryValueElement =
88
| boolean
99
| Date
1010
| bigint
11-
| null
1211

1312
export type AbstractQuery = Record<
1413
string,
@@ -55,7 +54,7 @@ export type AbstractQueryOptions = {
5554
/**
5655
* How the abstract query is converted to an actual query.
5756
*
58-
* @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)`.
57+
* @default Each value that is not undefined is converted to a string by calling `.toString()`.
5958
*/
6059
convertToQuery: (abstractQuery: Partial<AbstractQuery>) => Query
6160
}
@@ -65,7 +64,7 @@ const DEFAULT_ABSTRACT_QUERY_OPTIONS: AbstractQueryOptions = {
6564
const query: Query = {}
6665
for (const [key, value] of Object.entries(abstractQuery)) {
6766
if (value !== undefined) {
68-
query[key] = value === null ? '' : String(value)
67+
query[key] = value.toString()
6968
}
7069
}
7170
return query

src/routers/__test__/nextRouter.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { expectTypeOf, vi } from 'vitest'
55
import { useQuery, useQueryAndPagination } from '../../zod/routers/nextRouter'
66
import { usePagination } from '../nextRouter'
77

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

1011
describe('NextRouter', () => {
1112
beforeEach(() => {

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"extends": "@aboutbits/ts-config/react",
33
"compilerOptions": {
4-
"module": "es2020",
54
"moduleResolution": "node",
65
"skipLibCheck": true
76
},

0 commit comments

Comments
 (0)