From 62d3afb1e94602bf16d7b0b48da95a3c3f8cd2cf Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Mon, 30 Oct 2017 19:50:58 -0400 Subject: [PATCH] Use boolean instead of Boolish --- types/lodash/index.d.ts | 23 +++++++++++------------ types/lodash/lodash-tests.ts | 9 --------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 408e45a266..12e4b0c584 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -4321,7 +4321,7 @@ declare namespace _ { */ filter( collection: string | null | undefined, - predicate?: StringIterator + predicate?: StringIterator ): string[]; /** @@ -4363,7 +4363,7 @@ declare namespace _ { */ filter( this: LoDashImplicitWrapper, - predicate?: StringIterator + predicate?: StringIterator ): LoDashImplicitWrapper; /** @@ -4405,7 +4405,7 @@ declare namespace _ { */ filter( this: LoDashExplicitWrapper, - predicate?: StringIterator + predicate?: StringIterator ): LoDashExplicitWrapper; /** @@ -6458,7 +6458,7 @@ declare namespace _ { */ reject( collection: string | null | undefined, - predicate?: StringIterator + predicate?: StringIterator ): string[]; /** @@ -6484,7 +6484,7 @@ declare namespace _ { */ reject( this: LoDashImplicitWrapper, - predicate?: StringIterator + predicate?: StringIterator ): LoDashImplicitWrapper; /** @@ -6510,7 +6510,7 @@ declare namespace _ { */ reject( this: LoDashExplicitWrapper, - predicate?: StringIterator + predicate?: StringIterator ): LoDashExplicitWrapper; /** @@ -16590,17 +16590,16 @@ declare namespace _ { } type NotVoid = {} | null | undefined; - type Boolish = boolean | null | undefined; type ArrayIterator = (value: T, index: number, collection: T[]) => TResult; type ListIterator = (value: T, index: number, collection: List) => TResult; type ListIteratee = ListIterator | string | [string, any] | PartialDeep; - type ListIterateeBoolean = ListIterator | string | [string, any] | PartialDeep; + type ListIterateeBoolean = ListIterator | string | [string, any] | PartialDeep; type ListIteratorTypeGuard = (value: T, index: number, collection: List) => value is S; // Note: key should be string, not keyof T, because the actual object may contain extra properties that were not specified in the type. type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; type ObjectIteratee = ObjectIterator | string | [string, any] | PartialDeep; - type ObjectIterateeBoolean = ObjectIterator | string | [string, any] | PartialDeep; + type ObjectIterateeBoolean = ObjectIterator | string | [string, any] | PartialDeep; type ObjectIteratorTypeGuard = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S; type DictionaryIterator = ObjectIterator, TResult>; @@ -16609,7 +16608,7 @@ declare namespace _ { type NumericDictionaryIterator = (value: T, key: number, collection: NumericDictionary) => TResult; type NumericDictionaryIteratee = NumericDictionaryIterator | string | [string, any] | PartialDeep; - type NumericDictionaryIterateeBoolean = NumericDictionaryIterator | string | [string, any] | PartialDeep; + type NumericDictionaryIterateeBoolean = NumericDictionaryIterator | string | [string, any] | PartialDeep; type StringIterator = (char: string, index: number, string: string) => TResult; @@ -16625,8 +16624,8 @@ declare namespace _ { type ValueIteratee = ((value: T) => NotVoid) | string | [string, any] | PartialDeep; type ValueKeyIteratee = ((value: T, key: string) => NotVoid) | string | [string, any] | PartialDeep; - type Comparator = (a: T, b: T) => Boolish; - type Comparator2 = (a: T1, b: T2) => Boolish; + type Comparator = (a: T, b: T) => boolean; + type Comparator2 = (a: T1, b: T2) => boolean; type PropertyName = string | number; type PropertyPath = Many; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 338d66ced5..a108df685e 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -689,12 +689,7 @@ namespace TestDifferenceBy { const t1: T1 = { a: 'a', b: 'b' }; const t2: T2 | undefined = any; - const comparator = (a: T1, b: T2 | undefined): boolean | undefined => { - return b && a.a === b.a; - }; - // $ExpectType T1[] - _.differenceWith([t1], [t2], comparator); // $ExpectType T1[] _.differenceWith([t1], [t2], (a, b) => { a; // $ExpectType T1 @@ -702,8 +697,6 @@ namespace TestDifferenceBy { return true; }); - // $ExpectType LoDashImplicitWrapper - _([t1]).differenceWith([t2], comparator); // $ExpectType LoDashImplicitWrapper _([t1]).differenceWith([t2], (a, b) => { a; // $ExpectType T1 @@ -711,8 +704,6 @@ namespace TestDifferenceBy { return true; }); - // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceWith([t2], comparator); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceWith([t2], (a, b) => { a; // $ExpectType T1