diff --git a/lib/interfaces/type.interface.ts b/lib/interfaces/type.interface.ts index 2e148dad..99e5d562 100644 --- a/lib/interfaces/type.interface.ts +++ b/lib/interfaces/type.interface.ts @@ -1,3 +1,9 @@ export interface Type extends Function { new (...args: any[]): T; } + +export type WithoutCallback = + // T extends any makes this distributive + T extends any ? + T extends [...infer U, any] ? U : T + : never; diff --git a/lib/passport/passport.strategy.ts b/lib/passport/passport.strategy.ts index f60e4d6f..86a4a7bc 100644 --- a/lib/passport/passport.strategy.ts +++ b/lib/passport/passport.strategy.ts @@ -1,12 +1,12 @@ import * as passport from 'passport'; -import { Type } from '../interfaces'; +import { Type, WithoutCallback} from '../interfaces'; export function PassportStrategy = any>( Strategy: T, name?: string | undefined, callbackArity?: true | number ): { - new (...args): InstanceType; + new (...args: WithoutCallback>): InstanceType; } { abstract class MixinStrategy extends Strategy { abstract validate(...args: any[]): any;