AndrewKeig/express-validation

JoiError and ValidationError type clashing

cmdcarini opened this issue · 3 comments

The fix introduced in #134 actually made our TS build pass. In versions before (and after) v3.0.7, our usage of the constructor ValidationError(message, details/req, original/res) fails as it isn't expecting parameters in the constructor (because one isn't defined by express-validation, but is in Joi).

Ex. of TS code that works in v3.0.7 but not in other versions

const error = new ValidationError('test', { body: [] }, {});

Any suggestions? For now we'll just stay on v3.0.7

The change from #134 was reverted in 71b746e, which was released in 3.1.0.

2nd attempt: #157

The params for ValidationError are slightly different from what you put above: It's new ValidationError({ body: [] }, {});

Should be fixed in 4.0.1 now.