Skip to content

fix: More specific return types. #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2020
Merged

fix: More specific return types. #28

merged 1 commit into from
May 16, 2020

Conversation

wSedlacek
Copy link
Contributor

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.

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.
@P4sca1
Copy link

P4sca1 commented May 13, 2020

This change also prevents errors when using this with epxress-graphql as it expects validationRules to be more specific than just a Function[].

@ivome
Copy link
Collaborator

ivome commented May 16, 2020

Thanks for the fix @wSedlacek

@ivome ivome merged commit 76dfdba into slicknode:master May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants