Skip to content

Commit

Permalink
fix(Skip, Limit): make skip and limit only accept number amounts
Browse files Browse the repository at this point in the history
Change the type signature for both skip and limit to prevent them from accepting a string argument.
While passing in a string would still functionally work, it is probably a bug as argument only makes
sense with a numeric value.

BREAKING CHANGE: The type of skip and limit clauses no longer accept a string. This will only effect
typescript users, there is no breaking change for javascript users.
  • Loading branch information
jamesfer committed Jun 25, 2019
1 parent 7f6360c commit cfb62c3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export abstract class Builder<Q> extends SetBlock<Q> {
* @param {string | number} amount
* @returns {Q}
*/
limit(amount: string | number) {
limit(amount: number) {
return this.continueChainClause(new Limit(amount));
}

Expand Down Expand Up @@ -630,7 +630,7 @@ export abstract class Builder<Q> extends SetBlock<Q> {
* @param {string | number} amount
* @returns {Q}
*/
skip(amount: string | number) {
skip(amount: number) {
return this.continueChainClause(new Skip(amount));
}

Expand Down
2 changes: 1 addition & 1 deletion src/clauses/limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Parameter } from '../parameter-bag';
export class Limit extends Clause {
protected amountParam: Parameter;

constructor(public amount: number | string) {
constructor(public amount: number) {
super();
this.amountParam = this.addParam(amount, 'limitCount');
}
Expand Down
2 changes: 1 addition & 1 deletion src/clauses/skip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Clause } from '../clause';
export class Skip extends Clause {
protected amountParam;

constructor(public amount: number | string) {
constructor(public amount: number) {
super();
this.amountParam = this.addParam(amount, 'skipCount');
}
Expand Down

0 comments on commit cfb62c3

Please sign in to comment.