Skip to content

Commit

Permalink
fix(): Preserve callback.length for strategy constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
egormkn committed Nov 17, 2020
1 parent e2e8817 commit b9d080f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/passport/passport.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ export function PassportStrategy<T extends Type<any> = any>(
}
};

super(...args, callback);
if (this.validate) {
const validate = new.target.prototype.validate;
if (validate) {
Object.defineProperty(callback, 'length', {
value: this.validate.length + 1
value: validate.length + 1
});
}
super(...args, callback);

const passportInstance = this.getPassportInstance();
if (name) {
Expand Down

0 comments on commit b9d080f

Please sign in to comment.