diff --git a/src/config/index.ts b/src/config/index.ts index 9b80fa02..e08c1b30 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,5 +1,5 @@ import { EventEmitter } from 'events'; -import { Transaction } from 'knex'; +import type { Transaction } from 'knex'; import * as _ from 'lodash'; import StrictEventEmitter from 'strict-event-emitter-types'; import { inspect } from 'util'; @@ -54,7 +54,7 @@ export async function get( key: T, trx?: Transaction, ): Promise> { - const $db = trx || db.models.bind(db); + const $db = trx || db.models; if (Schema.schema.hasOwnProperty(key)) { const schemaKey = key as Schema.SchemaKey; @@ -183,7 +183,7 @@ export async function set( if (trx != null) { await setValuesInTransaction(trx); } else { - await db.transaction((tx: Transaction) => setValuesInTransaction(tx)); + await db.transaction((tx) => setValuesInTransaction(tx)); } events.emit('change', keyValues as ConfigMap); } @@ -235,7 +235,7 @@ export function valueIsValid( async function getSchema( key: T, - $db: Transaction, + $db: typeof db.models, ): Promise { let value: unknown; switch (Schema.schema[key].source) { diff --git a/tsconfig.json b/tsconfig.json index ac51fe59..5759b187 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,10 +2,11 @@ "compilerOptions": { "target": "ES2019", "module": "commonjs", - "noImplicitAny": true, + "strict": true, + "strictFunctionTypes": false, + "strictPropertyInitialization": false, "preserveConstEnums": true, "inlineSourceMap": true, - "strictNullChecks": true, "outDir": "./build/", "skipLibCheck": true, "lib": ["es6"],