-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Milestone
Description
Support plan
- is this issue currently blocking your project? (yes/no): no
- is this issue affecting a production system? (yes/no): no
Context
- node version: 14.16.0
- module version with issue: 17.4.0
- last module version without issue:
- environment (e.g. node, browser, native): node
- used with (e.g. hapi application, another framework, standalone, ...): typescript
- any other relevant information:
What are you trying to achieve or the steps to reproduce?
// using an external method in a TypeScript project
const isValidUser = async (value: any, helpers: any): Promise<any> { ... }
const userSchema = Joi.string().external(isValidUser)What was the result you got?
Argument of type '(value: any, helpers: any) => Promise<any>' is not assignable to parameter of type 'ExternalValidationFunction'.
What result did you expect?
The ExternalValidationFunction type supports the helpers parameter as indicated in the documentation, even when used with TypeScript. At the least, the typing should probably be:
type ExternalValidationFunction = (value: any, helpers: any) => Promise<any>;
Reactions are currently unavailable