Use boolean instead of Boolish

This commit is contained in:
AJ Richardson
2017-10-30 19:50:58 -04:00
parent 5ed4c19b3c
commit 62d3afb1e9
2 changed files with 11 additions and 21 deletions
+11 -12
View File
@@ -4321,7 +4321,7 @@ declare namespace _ {
*/
filter(
collection: string | null | undefined,
predicate?: StringIterator<Boolish>
predicate?: StringIterator<boolean>
): string[];
/**
@@ -4363,7 +4363,7 @@ declare namespace _ {
*/
filter(
this: LoDashImplicitWrapper<string | null | undefined>,
predicate?: StringIterator<Boolish>
predicate?: StringIterator<boolean>
): LoDashImplicitWrapper<string[]>;
/**
@@ -4405,7 +4405,7 @@ declare namespace _ {
*/
filter(
this: LoDashExplicitWrapper<string | null | undefined>,
predicate?: StringIterator<Boolish>
predicate?: StringIterator<boolean>
): LoDashExplicitWrapper<string[]>;
/**
@@ -6458,7 +6458,7 @@ declare namespace _ {
*/
reject(
collection: string | null | undefined,
predicate?: StringIterator<Boolish>
predicate?: StringIterator<boolean>
): string[];
/**
@@ -6484,7 +6484,7 @@ declare namespace _ {
*/
reject(
this: LoDashImplicitWrapper<string | null | undefined>,
predicate?: StringIterator<Boolish>
predicate?: StringIterator<boolean>
): LoDashImplicitWrapper<string[]>;
/**
@@ -6510,7 +6510,7 @@ declare namespace _ {
*/
reject(
this: LoDashExplicitWrapper<string | null | undefined>,
predicate?: StringIterator<Boolish>
predicate?: StringIterator<boolean>
): LoDashExplicitWrapper<string[]>;
/**
@@ -16590,17 +16590,16 @@ declare namespace _ {
}
type NotVoid = {} | null | undefined;
type Boolish = boolean | null | undefined;
type ArrayIterator<T, TResult> = (value: T, index: number, collection: T[]) => TResult;
type ListIterator<T, TResult> = (value: T, index: number, collection: List<T>) => TResult;
type ListIteratee<T> = ListIterator<T, NotVoid> | string | [string, any] | PartialDeep<T>;
type ListIterateeBoolean<T> = ListIterator<T, Boolish> | string | [string, any] | PartialDeep<T>;
type ListIterateeBoolean<T> = ListIterator<T, boolean> | string | [string, any] | PartialDeep<T>;
type ListIteratorTypeGuard<T, S extends T> = (value: T, index: number, collection: List<T>) => 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<TObject, TResult> = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult;
type ObjectIteratee<TObject> = ObjectIterator<TObject, NotVoid> | string | [string, any] | PartialDeep<TObject[keyof TObject]>;
type ObjectIterateeBoolean<TObject> = ObjectIterator<TObject, Boolish> | string | [string, any] | PartialDeep<TObject[keyof TObject]>;
type ObjectIterateeBoolean<TObject> = ObjectIterator<TObject, boolean> | string | [string, any] | PartialDeep<TObject[keyof TObject]>;
type ObjectIteratorTypeGuard<TObject, S extends TObject[keyof TObject]> = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S;
type DictionaryIterator<T, TResult> = ObjectIterator<Dictionary<T>, TResult>;
@@ -16609,7 +16608,7 @@ declare namespace _ {
type NumericDictionaryIterator<T, TResult> = (value: T, key: number, collection: NumericDictionary<T>) => TResult;
type NumericDictionaryIteratee<T> = NumericDictionaryIterator<T, NotVoid> | string | [string, any] | PartialDeep<T>;
type NumericDictionaryIterateeBoolean<T> = NumericDictionaryIterator<T, Boolish> | string | [string, any] | PartialDeep<T>;
type NumericDictionaryIterateeBoolean<T> = NumericDictionaryIterator<T, boolean> | string | [string, any] | PartialDeep<T>;
type StringIterator<TResult> = (char: string, index: number, string: string) => TResult;
@@ -16625,8 +16624,8 @@ declare namespace _ {
type ValueIteratee<T> = ((value: T) => NotVoid) | string | [string, any] | PartialDeep<T>;
type ValueKeyIteratee<T> = ((value: T, key: string) => NotVoid) | string | [string, any] | PartialDeep<T>;
type Comparator<T> = (a: T, b: T) => Boolish;
type Comparator2<T1, T2> = (a: T1, b: T2) => Boolish;
type Comparator<T> = (a: T, b: T) => boolean;
type Comparator2<T1, T2> = (a: T1, b: T2) => boolean;
type PropertyName = string | number;
type PropertyPath = Many<PropertyName>;
-9
View File
@@ -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[]>
_([t1]).differenceWith([t2], comparator);
// $ExpectType LoDashImplicitWrapper<T1[]>
_([t1]).differenceWith([t2], (a, b) => {
a; // $ExpectType T1
@@ -711,8 +704,6 @@ namespace TestDifferenceBy {
return true;
});
// $ExpectType LoDashExplicitWrapper<T1[]>
_.chain([t1]).differenceWith([t2], comparator);
// $ExpectType LoDashExplicitWrapper<T1[]>
_.chain([t1]).differenceWith([t2], (a, b) => {
a; // $ExpectType T1