mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 03:02:04 +08:00
joi: add missing 'alt' method
This commit is contained in:
10
types/joi/index.d.ts
vendored
10
types/joi/index.d.ts
vendored
@@ -551,7 +551,7 @@ export interface StringSchema extends AnySchema {
|
||||
* Requires the string value to be a valid GUID.
|
||||
*/
|
||||
guid(options?: GuidOptions): this;
|
||||
|
||||
|
||||
/**
|
||||
* Alias for `guid` -- Requires the string value to be a valid GUID
|
||||
*/
|
||||
@@ -962,10 +962,15 @@ export function string(): StringSchema;
|
||||
/**
|
||||
* Generates a type that will match one of the provided alternative schemas
|
||||
*/
|
||||
export function alternatives(): AlternativesSchema;
|
||||
export function alternatives(types: SchemaLike[]): AlternativesSchema;
|
||||
export function alternatives(...types: SchemaLike[]): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Alias for `alternatives`
|
||||
*/
|
||||
export function alt(types: SchemaLike[]): AlternativesSchema;
|
||||
export function alt(...types: SchemaLike[]): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Generates a placeholder schema for a schema that you would provide with the fn.
|
||||
* Supports the same methods of the any() type.
|
||||
@@ -1031,3 +1036,4 @@ export function extend(extention: Extension): any;
|
||||
* Returns a plain object representing the schema's rules and properties
|
||||
*/
|
||||
export function describe(schema: Schema): Description;
|
||||
|
||||
|
||||
@@ -830,6 +830,13 @@ schema = Joi.alternatives().try(schema, schema);
|
||||
schema = Joi.alternatives(schemaArr);
|
||||
schema = Joi.alternatives(schema, anySchema, boolSchema);
|
||||
|
||||
schema = Joi.alt();
|
||||
schema = Joi.alt().try(schemaArr);
|
||||
schema = Joi.alt().try(schema, schema);
|
||||
|
||||
schema = Joi.alt(schemaArr);
|
||||
schema = Joi.alt(schema, anySchema, boolSchema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.lazy(() => schema)
|
||||
|
||||
Reference in New Issue
Block a user