Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constructor definition for QueryBuilder class for typescript inheritance #2232

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ADD: Constructor type on QueryBuilder class type
  • Loading branch information
ralcorta committed Feb 22, 2022
commit 4ef206742caeabddf7981d0fc41d1ea3f22443ad
10 changes: 2 additions & 8 deletions lib/objection.js
Original file line number Diff line number Diff line change
@@ -40,14 +40,8 @@ function Model() {
// Nothing to do here.
}

// function QueryBuilder(...args) {
// NativeQueryBuilder.init(this, ...args);
// }

class QueryBuilder {
constructor(...args) {
NativeQueryBuilder.init(this, ...args);
}
function QueryBuilder(...args) {
NativeQueryBuilder.init(this, ...args);
}

function Validator(...args) {
1 change: 1 addition & 0 deletions typings/objection/index.d.ts
Original file line number Diff line number Diff line change
@@ -780,6 +780,7 @@ declare namespace Objection {
export class QueryBuilder<M extends Model, R = M[]> implements CatchablePromiseLike<R> {
static forClass: ForClassMethod;
new(...args: any[]): this;
constructor(...args: any[]): this;

select: SelectMethod<this>;
columns: SelectMethod<this>;