From 315535d8722f6abf0778d181857cc0e54bb3e602 Mon Sep 17 00:00:00 2001 From: Marcin L <62071967+marcinlee@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:52:28 +0200 Subject: [PATCH] expand allowed types for tableRefFor and tableNameFor it fixes: Argument of type 'ModelClass' is not assignable to parameter of type 'typeof Model' --- tests/ts/examples.ts | 1 + typings/objection/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/ts/examples.ts b/tests/ts/examples.ts index 939e1c9cf..af4476c1b 100644 --- a/tests/ts/examples.ts +++ b/tests/ts/examples.ts @@ -833,6 +833,7 @@ const modelFromQuery = qb.modelClass(); const knexQuery = qb.toKnexQuery().toSQL(); const tableName: string = qb.tableNameFor(Person); const tableRef: string = qb.tableRefFor(Person); +const tableRefModelClass: string = qb.tableRefFor(modelFromQuery); function noop() { // no-op diff --git a/typings/objection/index.d.ts b/typings/objection/index.d.ts index e14784130..910738c87 100644 --- a/typings/objection/index.d.ts +++ b/typings/objection/index.d.ts @@ -690,7 +690,7 @@ declare namespace Objection { } interface TableRefForMethod { - (modelClass: typeof Model): string; + (modelClass: ModelClass | typeof Model): string; } interface AliasForMethod {