Closed nathan815 closed 3 years ago
Mentioning @aarifkhamdi as author of #200.
Workaround: downgrade celebrate to version 13.0.3.
npm install celebrate@13.0.3 --save-exact
how can i reproduce this error? try to provide repository maybe the parameter you are passing does not match the expected type
Hi @aarifkhamdi thanks for the response. I'm not passing any parameters; the error is happening in celebrate's declaration file on line 84 of lib/index.d.ts
even without any code referencing celebrate.
Maybe it's a version issue? I am on express 4.17.1 (other versions are in first comment). The error goes away when I downgrade to celebrate 13.0.3 which is right before the generic types were introduced. I put a caret pointing at the type parameter causing the error in first comment.
I dug through the types here and could not find exactly what is causing this. RequestHandler
should accept a ParamsDictionary
(P) type just fine. I'm not even sure where the type ParamsArray
is coming in to the picture.
I'll try making a public repo to reproduce this.
Looks like this problem was actually caused by @types/express
. I was able to fix it by upgrading @types/express
to 4.17.9 🙂
Closing this issue.
Should the type defs for express be included in celebrate to prevent this? I'm not super familiar with how other packages handle their type def files and dependencies.
@arb I'm not sure if it would help since the application using celebrate still needs to have express and the express types package installed anyway. From what I read this has been a frequent issue with express and its types package.
Right but I could move those type definition files into the formal dependencies
of celebrate so they are installed along with celebrate
? I don't personally use TypeScript so I don't really have any real world experience dealing with these kinds of issues or how they are typically solved by other modules.
Frankly, the type script definition file has been the most troublesome aspect of this module and I've contemplated removing them several times.
node
version - 13.14.0celebrate
version - 13.0.4joi
version (vianpm ls --depth=0 | grep joi
) - 17.3.0express
version - 4.17.1@types/express
version - 4.17.6My
joi
schema looks like this:not applicable
The issue I am having with
celebrate
is:I am getting this Typescript compilation error as soon as I import celebrate:
Not sure how exactly to fix this yet, but:
celebrate/lib/index.d.ts:84
: