diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 4eea606a6..a00543fe4 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -97,7 +97,7 @@ uriOpts = {scheme: expArr}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var whenOpts: Joi.WhenOptions = null; +var whenOpts: Joi.WhenOptions = null; whenOpts = {is: x}; whenOpts = {is: schema, then: schema}; diff --git a/joi/joi.d.ts b/joi/joi.d.ts index c5d78dc88..d9ee7c20d 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -95,11 +95,11 @@ declare module 'joi' { scheme ?: string | RegExp | Array; } - export interface WhenOptions { + export interface WhenOptions { /** * the required condition joi type. */ - is: any; + is: T; /** * the alternative schema type if the condition is true. Required if otherwise is missing. */ @@ -269,8 +269,8 @@ declare module 'joi' { /** * Converts the type into an alternatives type where the conditions are merged into the type definition where: */ - when(ref: string, options: WhenOptions): AlternativesSchema; - when(ref: Reference, options: WhenOptions): AlternativesSchema; + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; /** * Overrides the key name in error messages. @@ -691,8 +691,8 @@ declare module 'joi' { export interface AlternativesSchema extends AnySchema { try(schemas: Schema[]): AlternativesSchema; - when(ref: string, options: WhenOptions): AlternativesSchema; - when(ref: Reference, options: WhenOptions): AlternativesSchema; + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---