objection.js icon indicating copy to clipboard operation
objection.js copied to clipboard

Missing typings for QueryBuilder.tableRef

Open IlyaSemenov opened this issue 1 year ago • 2 comments

QueryBuilder has a convenient method tableRef which returns the alias for the model the query builder operates against:

https://github.com/Vincit/objection.js/blob/1b74f756c8afd3bab7964ac3aea7438b95edce44/lib/queryBuilder/QueryBuilder.js#L87-L89

However it's not exposed in typings and not mentioned in the documentation. Can we add it?


On a side note, its implementation clearly contradicts the typings for tableRefFor:

https://github.com/Vincit/objection.js/blob/1b74f756c8afd3bab7964ac3aea7438b95edce44/typings/objection/index.d.ts#L615-L617

the method is supposed to accept a model class, but the actual implementation passes a string.

IlyaSemenov avatar Mar 16 '23 10:03 IlyaSemenov

Thanks for pointing this out. Would you be willing to submit a PR to fix this?

lehni avatar Apr 14 '23 18:04 lehni

Sure.

IlyaSemenov avatar Apr 14 '23 18:04 IlyaSemenov