From 5e79f2891d359f899207a4c5cfd2e4a057e65e13 Mon Sep 17 00:00:00 2001 From: Marouane Fazouane Date: Thu, 30 Apr 2020 09:11:33 +0000 Subject: [PATCH 1/2] Typeguard-friendly Array#every --- lib/lib.es5.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index 65c0c012fe71d..7cac85d852630 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -1138,6 +1138,15 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in the array until the callbackfn returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: readonly T[]) => value is TValue, thisArg?: any): this is readonly TValue[]; /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls @@ -1308,6 +1317,15 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in the array until the callbackfn returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => value is TValue, thisArg?: any): this is TValue[]; /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls From 4fbf5c10d072071b385adc33a431d760243c2bff Mon Sep 17 00:00:00 2001 From: Marouane Fazouane Date: Thu, 30 Apr 2020 09:38:22 +0000 Subject: [PATCH 2/2] update the source files --- src/lib/es5.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 478f78f772a07..32c74329a73bc 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1118,6 +1118,15 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in the array until the callbackfn returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: readonly T[]) => value is TValue, thisArg?: any): this is readonly TValue[]; /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls @@ -1288,6 +1297,15 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in the array until the callbackfn returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => value is TValue, thisArg?: any): this is TValue[]; /** * Determines whether the specified callback function returns true for any element of an array. * @param callbackfn A function that accepts up to three arguments. The some method calls