From 53db6aaff3fdc9baa3e5fb1209739f76f63835f8 Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Tue, 22 Jan 2019 19:51:15 +0900 Subject: [PATCH 1/3] give the correct type --- types/yup/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index 0afaf1fd9d..57aa0ab8c8 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -163,7 +163,7 @@ export interface ArraySchema extends Schema { min(limit: number | Ref, message?: TestOptionsMessage): ArraySchema; max(limit: number | Ref, message?: TestOptionsMessage): ArraySchema; ensure(): ArraySchema; - compact(rejector?: (value: any) => boolean): ArraySchema; + compact(rejector?: (value: T, index: number, array: T[]) => boolean): ArraySchema; } export type ObjectSchemaDefinition = { From cfa7877f5ff58648fef26fc5b2adc55a1a709dc7 Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Tue, 22 Jan 2019 19:55:49 +0900 Subject: [PATCH 2/3] add a signature --- types/yup/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index 57aa0ab8c8..ffba765581 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -7,6 +7,7 @@ // Yash Kulshrestha // Vincent Pizzo // Robert Bullen +// Yusuke Sato // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From b2eecefe079c83df1c8cde9a2fcbba027f74bb19 Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Tue, 22 Jan 2019 20:00:00 +0900 Subject: [PATCH 3/3] modify a test --- types/yup/yup-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 361cc62084..a90a7df25d 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -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