mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
joi: add support for array.unique(comparator) (#16200)
Add an optional extended description…
This commit is contained in:
committed by
Sheetal Nandi
parent
cb42760188
commit
0aa77fc2b3
3
types/joi/index.d.ts
vendored
3
types/joi/index.d.ts
vendored
@@ -567,7 +567,8 @@ export interface ArraySchema extends AnySchema<ArraySchema> {
|
||||
* 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<ObjectSchema> {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user