I am trying to call a super
method where the definitions are the same as this method.
I call it like this:
return await super.chunk(...args)
However, it gives me this error:
Expected 2-3 arguments, but got 0 or more.
So, I tried to type the value passed in like this:
return await super.chunk(...args as [number, number | Function, Function?])
But that gives me this error:
Argument of type 'number | Function' is not assignable to parameter of type 'number'.
Type 'Function' is not assignable to type 'number'.
Here is the full block:
public async chunk(max: number, offset: number, callback: (results: any[]) => void): Promise<DB>
public async chunk(max: number, callback: (results: any[]) => void): Promise<DB>
public async chunk(...args: (number | Function)[]): Promise<DB> {
this.table(this.$table)
return await super.chunk(...args as [number, number | Function, Function?])
}
Is there anyway that I can call the super method
without having to call it different times within if statements with different arguments?