Skip to content

Commit ac434be

Browse files
author
William Sedlacek
authored
fix: More specific return types.
Having a generic return type like `Function` is like using `any` it is removing type safety and causes Type Safe environments like NestJS to through errors. It is much better to specify the the return type of this higher order function. Generally I would let TypeScript infer it without the type def, however since you had it explicitly stated before I simply changed it to be more specific.
1 parent 73dd716 commit ac434be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { QueryComplexityOptions } from './QueryComplexity';
1010
export * from './estimators';
1111
export * from './QueryComplexity';
1212

13-
export default function createQueryComplexityValidator(options: QueryComplexityOptions): Function {
13+
export default function createQueryComplexityValidator(options: QueryComplexityOptions): (context: ValidationContext) => QueryComplexity {
1414
return (context: ValidationContext): QueryComplexity => {
1515
return new QueryComplexity(context, options);
1616
};

0 commit comments

Comments
 (0)