Enable strict options by default and only disable specific ones

Change-type: patch
This commit is contained in:
Pagan Gazzard 2021-03-22 13:29:53 +00:00
parent cc5fb4ac16
commit 2ae22b4fbd
2 changed files with 7 additions and 6 deletions

View File

@ -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<T extends SchemaTypeKey>(
key: T,
trx?: Transaction,
): Promise<SchemaReturn<T>> {
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<T extends SchemaTypeKey>(
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<SchemaTypeKey>);
}
@ -235,7 +235,7 @@ export function valueIsValid<T extends SchemaTypeKey>(
async function getSchema<T extends Schema.SchemaKey>(
key: T,
$db: Transaction,
$db: typeof db.models,
): Promise<unknown> {
let value: unknown;
switch (Schema.schema[key].source) {

View File

@ -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"],