-
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? no
- *is this issue affecting a production system?*no
Context
- node version: 14.16.0
- module version with issue: 17.4.0
- last module version without issue: NONE
- environment (e.g. node, browser, native): node
- used with (e.g. hapi application, another framework, standalone, ...): another framework ( nestjs)
- any other relevant information:
What are you trying to achieve or the steps to reproduce?
Joi.isSchema verifies that an object is joi schema or not, but in type definition it is not using type predicate to indicate the schema is of type joi schema when return value is true
function doSomeThingWithSchemaOrString(input:Joi.Schema|AnotherType){
if(Joi.isSchema(input)){
input.validate('a test validation input')
// ^^ Error: Property 'validate' does not exist on type Joi.Schema | AnotherType
}
}What was the result you got?
typescript error
What result did you expect?
the code should compile successfully
Reactions are currently unavailable