mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge pull request #32380 from sat0yu/modify-yup-array-compact
Modify the type of array.compact method in yup
This commit is contained in:
Vendored
+2
-1
@@ -7,6 +7,7 @@
|
||||
// Yash Kulshrestha <https://github.com/YashdalfTheGray>
|
||||
// Vincent Pizzo <https://github.com/vincentjames501>
|
||||
// Robert Bullen <https://github.com/robertbullen>
|
||||
// Yusuke Sato <https://github.com/sat0yu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -163,7 +164,7 @@ export interface ArraySchema<T> extends Schema<T[]> {
|
||||
min(limit: number | Ref, message?: TestOptionsMessage): ArraySchema<T>;
|
||||
max(limit: number | Ref, message?: TestOptionsMessage): ArraySchema<T>;
|
||||
ensure(): ArraySchema<T>;
|
||||
compact(rejector?: (value: any) => boolean): ArraySchema<T>;
|
||||
compact(rejector?: (value: T, index: number, array: T[]) => boolean): ArraySchema<T>;
|
||||
}
|
||||
|
||||
export type ObjectSchemaDefinition<T extends object> = {
|
||||
|
||||
@@ -367,7 +367,7 @@ arrSchema.max(5, () => "max");
|
||||
arrSchema.min(5);
|
||||
arrSchema.min(5, "min");
|
||||
arrSchema.min(5, () => "min");
|
||||
arrSchema.compact(value => value === null);
|
||||
arrSchema.compact((value, index, array) => value === array[index]);
|
||||
|
||||
yup.array(); // $ExpectType ArraySchema<{}>
|
||||
yup.array(yup.string()); // $ExpectType ArraySchema<string>
|
||||
|
||||
Reference in New Issue
Block a user