diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ed8e88..a185a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ ## Version History +### v15.10.0 + +- :rocket: Add TS `strict` mode + ### v15.9.0 - :bug: Set no-verify option in pgStructure as it uses node-pg diff --git a/generic.ts b/generic.ts index 7355d0f..6de105a 100644 --- a/generic.ts +++ b/generic.ts @@ -70,7 +70,7 @@ export class GenericEmitter>> { const order = query.sort && query.sort === 'desc' ? desc : asc; - const orderBy = order(query.sort ? this.#key(query.sort) : this.#primaryKey()); + const orderBy = order(query.sort ? this.#key(query.sort) : this.#requiredPrimaryKey()); const pgres = await this.pool.select({ count: sql`count(*) OVER()`.as('count'), @@ -153,7 +157,7 @@ export default class Drizzle): Promise> { const pgres = await this.pool.select() .from(this.generic) - .where(is(id, SQL)? id as SQL : eq(this.#primaryKey(true), id)) + .where(is(id, SQL)? id as SQL : eq(this.#requiredPrimaryKey(), id)) .limit(1) if (pgres.length !== 1) throw new Err(404, null, `Item Not Found`); @@ -164,7 +168,7 @@ export default class Drizzle, values: object): Promise> { const pgres = await this.pool.update(this.generic) .set(values) - .where(is(id, SQL)? id as SQL : eq(this.#primaryKey(true), id)) + .where(is(id, SQL)? id as SQL : eq(this.#requiredPrimaryKey(), id)) .returning(); return pgres[0] as InferSelectModel; @@ -184,7 +188,7 @@ export default class Drizzle): Promise { await this.pool.delete(this.generic) - .where(is(id, SQL)? id as SQL : eq(this.#primaryKey(true), id)) + .where(is(id, SQL)? id as SQL : eq(this.#requiredPrimaryKey(), id)) } } diff --git a/tsconfig.json b/tsconfig.json index 9f229c9..9e07649 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "esm": true }, "compilerOptions": { + "strict": true, "skipLibCheck": true, "module": "es2022", "esModuleInterop": true,