mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Joi: support alternatives() without parameters. Fix alternatives() not returning interface with try() member.
This commit is contained in:
@@ -732,6 +732,9 @@ namespace common {
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.alternatives();
|
||||
schema = Joi.alternatives().try(schemaArr);
|
||||
|
||||
schema = Joi.alternatives(schemaArr);
|
||||
schema = Joi.alternatives(schema, anySchema, boolSchema);
|
||||
|
||||
|
||||
5
joi/joi.d.ts
vendored
5
joi/joi.d.ts
vendored
@@ -747,8 +747,9 @@ declare module 'joi' {
|
||||
/**
|
||||
* Generates a type that will match one of the provided alternative schemas
|
||||
*/
|
||||
export function alternatives(types: Schema[]): Schema;
|
||||
export function alternatives(type1: Schema, type2: Schema, ...types: Schema[]): Schema;
|
||||
export function alternatives(): AlternativesSchema;
|
||||
export function alternatives(types: Schema[]): AlternativesSchema;
|
||||
export function alternatives(type1: Schema, type2: Schema, ...types: Schema[]): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Validates a value using the given schema and options.
|
||||
|
||||
Reference in New Issue
Block a user