Skip to content

Commit

Permalink
fix(core): fix inheritance constructior parameters type
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikjasek committed Oct 3, 2023
1 parent b153ea2 commit 69879a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/interfaces/type.interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
export interface Type<T = any> extends Function {
new (...args: any[]): T;
}

export type WithoutCallback<T extends any[]> =
// T extends any makes this distributive
T extends any ?
T extends [...infer U, any] ? U : T
: never;
4 changes: 2 additions & 2 deletions lib/passport/passport.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as passport from 'passport';
import { Type } from '../interfaces';
import { Type, WithoutCallback} from '../interfaces';

export function PassportStrategy<T extends Type<any> = any>(
Strategy: T,
name?: string | undefined,
callbackArity?: true | number
): {
new (...args): InstanceType<T>;
new (...args: WithoutCallback<ConstructorParameters<T>>): InstanceType<T>;
} {
abstract class MixinStrategy extends Strategy {
abstract validate(...args: any[]): any;
Expand Down

0 comments on commit 69879a7

Please sign in to comment.