diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 12aa17b643..9456fc5b64 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -714,6 +714,7 @@ export interface ArraySchema extends AnySchema { * Specifies the exact number of items in the array. */ length(limit: number): this; + length(limit: Reference): this; /** * Requires the array values to be unique. diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index def9eaafd4..392247fa5e 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -318,6 +318,7 @@ arrSchema = arrSchema.ordered([schemaMap, schemaMap, schemaLike]); arrSchema = arrSchema.min(num); arrSchema = arrSchema.max(num); arrSchema = arrSchema.length(num); +arrSchema = arrSchema.length(ref); arrSchema = arrSchema.unique(); arrSchema = arrSchema.unique((a, b) => a.test === b.test); arrSchema = arrSchema.unique('customer.id'); diff --git a/types/joi/v10/index.d.ts b/types/joi/v10/index.d.ts index e21edda875..e8202d77dd 100644 --- a/types/joi/v10/index.d.ts +++ b/types/joi/v10/index.d.ts @@ -670,6 +670,7 @@ export interface ArraySchema extends AnySchema { * Specifies the exact number of items in the array. */ length(limit: number): this; + length(limit: Reference): this; /** * Requires the array values to be unique. diff --git a/types/joi/v10/joi-tests.ts b/types/joi/v10/joi-tests.ts index b1f125a6ea..e1194f5b76 100644 --- a/types/joi/v10/joi-tests.ts +++ b/types/joi/v10/joi-tests.ts @@ -299,6 +299,7 @@ arrSchema = arrSchema.ordered([schemaMap, schemaMap, schemaLike]); arrSchema = arrSchema.min(num); arrSchema = arrSchema.max(num); arrSchema = arrSchema.length(num); +arrSchema = arrSchema.length(ref); arrSchema = arrSchema.unique(); arrSchema = arrSchema.unique((a, b) => a.test === b.test); arrSchema = arrSchema.unique('customer.id');