diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 1b4c3fcbaf..68eb27ca93 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -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; + diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 4f49a69b3f..5f44e6ad01 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -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)