diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index c11bcb9daf..b1696bb7ad 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -567,7 +567,8 @@ export interface ArraySchema extends AnySchema { * Be aware that a deep equality is performed on elements of the array having a type of object, * a performance penalty is to be expected for this kind of operation. */ - unique(): ArraySchema; + unique(comparator?: (a: any, b: any) => boolean): ArraySchema; + unique(comparator?: string): ArraySchema; } export interface ObjectSchema extends AnySchema { diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index f35a124183..a58623ea06 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -261,6 +261,8 @@ arrSchema = arrSchema.min(num); arrSchema = arrSchema.max(num); arrSchema = arrSchema.length(num); arrSchema = arrSchema.unique(); +arrSchema = arrSchema.unique((a, b) => a.test === b.test); +arrSchema = arrSchema.unique('customer.id'); arrSchema = arrSchema.items(numSchema);