You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tsc throw me an error saying that the second param optionsany.when cannot be an [].
Overload 1 of 2, '(ref: string | Reference, options: WhenOptions): AlternativesSchema', gave the following error.
Type '({ is: myKey; then: StringSchema; } | { is: myKey; then: StringSchema; otherwise: Schema; })[]' has no properties in common with type 'WhenOptions'.
Overload 2 of 2, '(ref: Schema, options: WhenSchemaOptions): AlternativesSchema', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'Schema'.
Support plan
Context
What are you trying to achieve or the steps to reproduce?
When I'm using the
any.when()
function with the shortcut for switch case:From (https://joi.dev/api/?v=17.3.0#anywhencondition-options):
What was the result you got?
tsc throw me an error saying that the second param
options
any.when
cannot be an[]
.What result did you expect?
Can transpile from TS to JS without any error.
I think I spoted the problem in the
index.d.ts
:https://github.com/sideway/joi/blob/master/lib/index.d.ts#L1161
Or
https://github.com/sideway/joi/blob/master/lib/index.d.ts#L2184
The text was updated successfully, but these errors were encountered: