Skip to content

Commit d3775ac

Browse files
Merge pull request #1866 from nestjs/fix/without-callback-fix
fix: exclude last argument only if its of type function (cb)
2 parents 28a0835 + 1a7123a commit d3775ac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/interfaces/type.interface.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ export interface Type<T = any> extends Function {
44

55
export type WithoutCallback<T extends any[]> =
66
// T extends any makes this distributive
7-
T extends any ? (T extends [...infer U, any] ? U : T) : never;
7+
T extends any
8+
? T extends [...infer U, infer C]
9+
? C extends Function
10+
? U
11+
: T
12+
: T
13+
: never;

0 commit comments

Comments
 (0)