Skip to content

Commit

Permalink
expand allowed types for tableRefFor and tableNameFor
Browse files Browse the repository at this point in the history
it fixes:
Argument of type 'ModelClass<Foo>' is not assignable to parameter of type 'typeof Model'
  • Loading branch information
marcinlee authored and falkenhawk committed Apr 26, 2023
1 parent 123efe2 commit 315535d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/ts/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion typings/objection/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ declare namespace Objection {
}

interface TableRefForMethod {
(modelClass: typeof Model): string;
(modelClass: ModelClass<Model> | typeof Model): string;
}

interface AliasForMethod<QB extends AnyQueryBuilder> {
Expand Down

0 comments on commit 315535d

Please sign in to comment.