-
Notifications
You must be signed in to change notification settings - Fork 639
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
base: main
Are you sure you want to change the base?
Conversation
Would love to know what the type signature of the constructor is supposed to be. Looks like it's a |
Hi @ankitr ! The idea of this is like this: export class BaseQueryBuilder<M extends Model, R = M[]> extends QueryBuilder<M, R> {
// ...
constructor(...args: any[]) {
super(...args);
this._handleSoftDelete();
}
// ... more code
} This works on Javascript, but don't work in Typescript. With this constructor typed, I guess people will be able to extend more functionalities to the queryBuilder strategy. |
New changes from base project
@ankitr Hello! It was a long time ago, but it's still a good approach. What do you think? I have a package from a fork with this change, good to check. |
@ankitr is this a forgotten repo or issue? |
There are a lot of unnecessary formatting changes in this PR, making a review difficult, and I will not merge it in this state. Could you change it so that only the lines that actually need to change are included? |
To allow inheritance from the QueryBuilder class and use the constructor method, we must add the constructor definition in index.d.ts