Skip to content

Commit

Permalink
Update to support newer TS and knex (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad authored Mar 11, 2023
1 parent fb8eff1 commit 625ff7a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [16.x]
node-version: [18.x]

steps:
- name: Checkout Repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3
with:
always-auth: false
node-version: ${{ matrix.node-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3
with:
always-auth: false
node-version: ${{ matrix.node-version }}
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [18.x]

steps:
- name: Checkout Repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3
with:
always-auth: false
node-version: ${{ matrix.node-version }}
Expand All @@ -35,5 +35,3 @@ jobs:

- name: Run lint:everything
run: npm run lint
env:
CI: true
9 changes: 6 additions & 3 deletions lib/objectUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function copyWithoutUndefined<T extends Record<K, V>, K extends string |
}, {} as Record<string, any>) as T
}

export function pick<T, K extends string | number | symbol>(
export function pick<T extends object, K extends string | number | symbol>(
source: T,
propNames: readonly K[]
): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>> {
Expand Down Expand Up @@ -44,7 +44,10 @@ export function pickWithoutUndefined<T, K extends string | number | symbol>(
return result
}

export function validateOnlyWhitelistedFields<T>(source: T, propNames: readonly string[]) {
export function validateOnlyWhitelistedFields<T extends object>(
source: T,
propNames: readonly string[]
) {
const keys = Object.keys(source)
for (var x = 0; x < keys.length; x++) {
if (propNames.indexOf(keys[x]) === -1) {
Expand All @@ -65,7 +68,7 @@ export function validateOnlyWhitelistedFieldsSet(
}
}

export function strictPickWithoutUndefined<T>(
export function strictPickWithoutUndefined<T extends object>(
source: T,
propNames: readonly string[]
): Pick<T, Exclude<keyof T, Exclude<keyof T, string>>> {
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "knex-utils",
"version": "5.5.1",
"version": "6.0.0",
"license": "MIT",
"maintainers": [
{
Expand All @@ -24,29 +24,29 @@
"prepublishOnly": "npm run build"
},
"peerDependencies": {
"knex": ">=0.95.4"
"knex": ">=2.0.0"
},
"devDependencies": {
"@types/jest": "^27.0.3",
"@types/node": "^18.14.6",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"eslint": "^8.4.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.4.3",
"knex": "^2.1.0",
"@types/jest": "^27.5.2",
"@types/node": "^18.15.0",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^27.5.1",
"knex": "^2.4.2",
"mysql": "^2.18.1",
"mysql2": "^3.2.0",
"pg": "^8.7.1",
"prettier": "^2.5.1",
"sqlite3": "^5.0.2",
"tedious": "^14.5.0",
"ts-jest": "^27.1.0",
"pg": "^8.10.0",
"prettier": "^2.8.4",
"sqlite3": "^5.1.4",
"tedious": "^14.7.0",
"ts-jest": "^27.1.5",
"typescript": "4.9.5"
},
"engines": {
"node": ">=10"
"node": ">=12"
},
"homepage": "http://github.com/knex/knex-utils",
"repository": {
Expand Down

0 comments on commit 625ff7a

Please sign in to comment.