arb / celebrate

A joi validation middleware for Express.
MIT License
1.33k stars 66 forks source link

Celebrate typing error #142

Closed Meemaw closed 4 years ago

Meemaw commented 4 years ago

After upgrading to celebrate v10.1.0 there is an error in typings.

node_modules/celebrate/lib/index.d.ts(63,26): error TS2315: Type 'ValidationResult' is not generic.
arb commented 4 years ago

That version of joi is not the one that ships with celebrate@10.1.0, just for your information. That being said... I don't really know TypeScript and welcome any and all TypeScript definition updates 😄

Does this prevent your code from actually running or is it just an annoying console error?

joffarex commented 4 years ago

So I guess the quick fix for this is to, in fact install @types/hapi__joi@15.x.x and not the latest version, as in 16, iirc they introduced new way to validate data. I really hope that you will update celebrate to work with joi@16, as it was way faster and actually cleaner..

arb commented 4 years ago

@joffarex have you seen #145 or #136 or https://github.com/arb/celebrate/milestone/35... you could say that "yes" I am working on it 😅

The "fix" is nothing. There shouldn't be an issue install celebrate@latest. The version of joi @Meemaw is using is NOT the one that ships with celebrate 10.1.0. My guess is he is trying to mix version 16 and version 15 which is where his errors are coming from.

arb commented 4 years ago

Closing due to inactivity.