mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #8681 from j-sheppard/master
Joi: change any.when options - is: attribute to type any
This commit is contained in:
+2
-2
@@ -97,9 +97,9 @@ uriOpts = {scheme: expArr};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var whenOpts: Joi.WhenOptions = null;
|
||||
var whenOpts: Joi.WhenOptions<any> = null;
|
||||
|
||||
whenOpts = {is: schema};
|
||||
whenOpts = {is: x};
|
||||
whenOpts = {is: schema, then: schema};
|
||||
whenOpts = {is: schema, otherwise: schema};
|
||||
|
||||
|
||||
Vendored
+6
-6
@@ -95,11 +95,11 @@ declare module 'joi' {
|
||||
scheme ?: string | RegExp | Array<string | RegExp>;
|
||||
}
|
||||
|
||||
export interface WhenOptions {
|
||||
export interface WhenOptions<T> {
|
||||
/**
|
||||
* the required condition joi type.
|
||||
*/
|
||||
is: Schema;
|
||||
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<U>(ref: string, options: WhenOptions<U>): AlternativesSchema;
|
||||
when<U>(ref: Reference, options: WhenOptions<U>): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Overrides the key name in error messages.
|
||||
@@ -691,8 +691,8 @@ declare module 'joi' {
|
||||
|
||||
export interface AlternativesSchema extends AnySchema<FunctionSchema> {
|
||||
try(schemas: Schema[]): AlternativesSchema;
|
||||
when(ref: string, options: WhenOptions): AlternativesSchema;
|
||||
when(ref: Reference, options: WhenOptions): AlternativesSchema;
|
||||
when<T>(ref: string, options: WhenOptions<T>): AlternativesSchema;
|
||||
when<T>(ref: Reference, options: WhenOptions<T>): AlternativesSchema;
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
Reference in New Issue
Block a user