diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 110ef3f..f9f16ab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,9 +7,27 @@ concurrency: cancel-in-progress: true jobs: + checks: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + strategy: + matrix: + node_version: [16, 18, 20] + steps: + - uses: actions/checkout@v4 + - uses: aboutbits/github-actions-node/setup-and-install@v2 + with: + node-version: ${{ matrix.node_version }} + - name: Lint + run: npm run lint + shell: bash + - name: Typecheck + run: npm run typecheck + shell: bash + test: runs-on: ubuntu-22.04 - timeout-minutes: 15 + timeout-minutes: 10 strategy: matrix: node_version: [16, 18, 20] @@ -18,4 +36,6 @@ jobs: - uses: aboutbits/github-actions-node/setup-and-install@v2 with: node-version: ${{ matrix.node_version }} - - run: npm run checks + - name: Test + run: npm run test + shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 419d92a..122bd18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,8 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, tag_name: '${{ github.ref }}', - name: 'Release ${{ github.ref_name }}' + name: 'Release ${{ github.ref_name }}', + prerelease: '${{ github.ref_name }}'.includes('-') }) - uses: aboutbits/github-actions-node/setup-and-install@v2 with: diff --git a/package-lock.json b/package-lock.json index 095b06b..d07f27b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aboutbits/react-pagination", - "version": "3.1.2", + "version": "3.1.3-beta.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aboutbits/react-pagination", - "version": "3.1.2", + "version": "3.1.3-beta.1", "license": "MIT", "devDependencies": { "@aboutbits/eslint-config": "^2.2.4", diff --git a/package.json b/package.json index 3d4e6b0..4366295 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aboutbits/react-pagination", - "version": "3.1.2", + "version": "3.1.3-beta.1", "description": "Pagination hooks for React", "author": "About Bits", "license": "MIT", @@ -81,7 +81,7 @@ "vitest": "^1.4.0" }, "peerDependencies": { - "next": "^12.0.0 || ^13.0.0 || ^14.0.0", + "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0", "react": "^16.0.0 || ^17.0.0 || ^18.0.0", "react-router-dom": "^6.0.0", "zod": "^3.0.0" diff --git a/src/engine/query.ts b/src/engine/query.ts index 3958bcf..5897f67 100644 --- a/src/engine/query.ts +++ b/src/engine/query.ts @@ -2,17 +2,7 @@ import { useCallback, useMemo } from 'react' export type Query = Record -export type AbstractQueryValueElement = - | string - | number - | boolean - | Date - | bigint - -export type AbstractQuery = Record< - string, - AbstractQueryValueElement | AbstractQueryValueElement[] -> +export type AbstractQuery = Record /** * Parses the query. @@ -59,7 +49,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 is converted to a string by calling `.toString()` or removed if not stringifyable. */ convertToQuery: (abstractQuery: Partial) => Query } @@ -69,10 +59,19 @@ const DEFAULT_ABSTRACT_QUERY_OPTIONS: AbstractQueryOptions = { const query: Query = {} for (const [key, value] of Object.entries(abstractQuery)) { if (Array.isArray(value)) { - query[key] = value.map((v) => v.toString()) + query[key] = value.map((v: unknown) => + typeof v?.toString === 'function' + ? // eslint-disable-next-line @typescript-eslint/no-base-to-string + v.toString() + : '', + ) } else { if (value !== undefined) { - query[key] = value.toString() + query[key] = + typeof value?.toString === 'function' + ? // eslint-disable-next-line @typescript-eslint/no-base-to-string + value.toString() + : '' } } }