mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
fix: Added Unique Array options.
This commit is contained in:
Vendored
+5
-1
@@ -209,6 +209,10 @@ export interface StringRegexOptions {
|
||||
invert?: boolean;
|
||||
}
|
||||
|
||||
export interface ArrayUniqueOptions {
|
||||
ignoreUndefined?: boolean;
|
||||
}
|
||||
|
||||
export interface JoiObject {
|
||||
isJoi: boolean;
|
||||
}
|
||||
@@ -762,7 +766,7 @@ 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(comparator?: string): this;
|
||||
unique(comparator?: string, options?: ArrayUniqueOptions): this;
|
||||
unique<T = any>(comparator?: (a: T, b: T) => boolean): this;
|
||||
}
|
||||
|
||||
|
||||
@@ -328,6 +328,7 @@ arrSchema = arrSchema.length(ref);
|
||||
arrSchema = arrSchema.unique();
|
||||
arrSchema = arrSchema.unique((a, b) => a.test === b.test);
|
||||
arrSchema = arrSchema.unique('customer.id');
|
||||
arrSchema = arrSchema.unique('customer.id', {ignoreUndefined: true});
|
||||
|
||||
arrSchema = arrSchema.items(numSchema);
|
||||
arrSchema = arrSchema.items(numSchema, strSchema, schemaLike);
|
||||
|
||||
Reference in New Issue
Block a user