Fix the remaining strictFunctionTypes issues

This commit is contained in:
AJ Richardson
2017-11-18 22:49:43 -05:00
parent 49f2d7ce15
commit efcfa29163
2 changed files with 131 additions and 150 deletions
+114 -64
View File
@@ -1234,7 +1234,7 @@ declare namespace _ {
*/
findIndex<T>(
array: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
@@ -1245,7 +1245,7 @@ declare namespace _ {
*/
findIndex<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
@@ -1256,7 +1256,7 @@ declare namespace _ {
*/
findIndex<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
@@ -1282,7 +1282,7 @@ declare namespace _ {
*/
findLastIndex<T>(
array: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
@@ -1293,7 +1293,7 @@ declare namespace _ {
*/
findLastIndex<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
@@ -1304,7 +1304,7 @@ declare namespace _ {
*/
findLastIndex<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
@@ -4315,6 +4315,14 @@ declare namespace _ {
* @param thisArg The this binding of iteratee.
* @return Returns the composed aggregate object.
*/
countBy<T>(
collection: string | null | undefined,
iteratee?: StringIterator<T>
): Dictionary<number>;
/**
* @see _.countBy
*/
countBy<T>(
collection: List<T> | null | undefined,
iteratee?: ListIteratee<T>
@@ -4338,6 +4346,14 @@ declare namespace _ {
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.countBy
*/
countBy<T>(
this: LoDashImplicitWrapper<string | null | undefined>,
iteratee?: StringIterator<T>
): LoDashImplicitWrapper<Dictionary<number>>;
/**
* @see _.countBy
*/
@@ -4364,6 +4380,14 @@ declare namespace _ {
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.countBy
*/
countBy<T>(
this: LoDashExplicitWrapper<string | null | undefined>,
iteratee?: StringIterator<T>
): LoDashExplicitWrapper<Dictionary<number>>;
/**
* @see _.countBy
*/
@@ -4479,7 +4503,7 @@ declare namespace _ {
*/
every<T>(
collection: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): boolean;
/**
@@ -4487,7 +4511,7 @@ declare namespace _ {
*/
every<T>(
collection: NumericDictionary<T> | null | undefined,
predicate?: NumericDictionaryIterateeBoolean<T>
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
/**
@@ -4495,7 +4519,7 @@ declare namespace _ {
*/
every<T extends object>(
collection: T | null | undefined,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): boolean;
}
@@ -4505,7 +4529,7 @@ declare namespace _ {
*/
every<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): boolean;
/**
@@ -4513,7 +4537,7 @@ declare namespace _ {
*/
every<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): boolean;
/**
@@ -4521,7 +4545,7 @@ declare namespace _ {
*/
every<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeBoolean<T>
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
}
@@ -4531,7 +4555,7 @@ declare namespace _ {
*/
every<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
/**
@@ -4539,7 +4563,7 @@ declare namespace _ {
*/
every<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
/**
@@ -4547,7 +4571,7 @@ declare namespace _ {
*/
every<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeBoolean<T>
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
}
@@ -4589,7 +4613,7 @@ declare namespace _ {
*/
filter<T>(
collection: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): T[];
/**
@@ -4605,7 +4629,7 @@ declare namespace _ {
*/
filter<T extends object>(
collection: T | null | undefined,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): Array<T[keyof T]>;
}
@@ -4631,7 +4655,7 @@ declare namespace _ {
*/
filter<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): LoDashImplicitWrapper<T[]>;
/**
@@ -4647,7 +4671,7 @@ declare namespace _ {
*/
filter<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashImplicitWrapper<Array<T[keyof T]>>;
}
@@ -4673,7 +4697,7 @@ declare namespace _ {
*/
filter<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): LoDashExplicitWrapper<T[]>;
/**
@@ -4689,7 +4713,7 @@ declare namespace _ {
*/
filter<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashExplicitWrapper<Array<T[keyof T]>>;
}
@@ -4724,7 +4748,7 @@ declare namespace _ {
*/
find<T>(
collection: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): T|undefined;
@@ -4742,7 +4766,7 @@ declare namespace _ {
*/
find<T extends object>(
collection: T | null | undefined,
predicate?: ObjectIterateeBoolean<T>,
predicate?: ObjectIterateeCustom<T, boolean>,
fromIndex?: number
): T[keyof T]|undefined;
}
@@ -4762,7 +4786,7 @@ declare namespace _ {
*/
find<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): T|undefined;
@@ -4780,7 +4804,7 @@ declare namespace _ {
*/
find<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>,
predicate?: ObjectIterateeCustom<T, boolean>,
fromIndex?: number
): T[keyof T]|undefined;
}
@@ -4800,7 +4824,7 @@ declare namespace _ {
*/
find<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<T|undefined>;
@@ -4818,7 +4842,7 @@ declare namespace _ {
*/
find<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>,
predicate?: ObjectIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<T[keyof T]|undefined>;
}
@@ -4844,7 +4868,7 @@ declare namespace _ {
*/
findLast<T>(
collection: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): T|undefined;
@@ -4862,7 +4886,7 @@ declare namespace _ {
*/
findLast<T extends object>(
collection: T | null | undefined,
predicate?: ObjectIterateeBoolean<T>,
predicate?: ObjectIterateeCustom<T, boolean>,
fromIndex?: number
): T[keyof T]|undefined;
}
@@ -4882,7 +4906,7 @@ declare namespace _ {
*/
findLast<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): T | undefined;
@@ -4900,7 +4924,7 @@ declare namespace _ {
*/
findLast<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>,
predicate?: ObjectIterateeCustom<T, boolean>,
fromIndex?: number
): T[keyof T]|undefined;
}
@@ -4920,7 +4944,7 @@ declare namespace _ {
*/
findLast<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<T | undefined>;
@@ -4938,7 +4962,7 @@ declare namespace _ {
*/
findLast<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>,
predicate?: ObjectIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<T[keyof T]|undefined>;
}
@@ -5849,9 +5873,17 @@ declare namespace _ {
* @param thisArg The this binding of iteratee.
* @return Returns the composed aggregate object.
*/
keyBy(
collection: string | null | undefined,
iteratee?: StringIterator<PropertyName>
): Dictionary<string>;
/**
* @see _.keyBy
*/
keyBy<T>(
collection: List<T> | null | undefined,
iteratee?: ListIteratee<T>
iteratee?: ListIterateeCustom<T, PropertyName>
): Dictionary<T>;
/**
@@ -5859,7 +5891,7 @@ declare namespace _ {
*/
keyBy<T extends object>(
collection: T | null | undefined,
iteratee?: ObjectIteratee<T>
iteratee?: ObjectIterateeCustom<T, PropertyName>
): Dictionary<T[keyof T]>;
/**
@@ -5867,17 +5899,25 @@ declare namespace _ {
*/
keyBy<T>(
collection: NumericDictionary<T> | null | undefined,
iteratee?: NumericDictionaryIteratee<T>
iteratee?: NumericDictionaryIterateeCustom<T, PropertyName>
): Dictionary<T>;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.keyBy
*/
keyBy(
this: LoDashImplicitWrapper<string | null | undefined>,
iteratee?: StringIterator<PropertyName>
): LoDashImplicitWrapper<Dictionary<string>>;
/**
* @see _.keyBy
*/
keyBy<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
iteratee?: ListIteratee<T>
iteratee?: ListIterateeCustom<T, PropertyName>
): LoDashImplicitWrapper<Dictionary<T>>;
/**
@@ -5885,7 +5925,7 @@ declare namespace _ {
*/
keyBy<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
iteratee?: ObjectIteratee<T>
iteratee?: ObjectIterateeCustom<T, PropertyName>
): LoDashImplicitWrapper<Dictionary<T[keyof T]>>;
/**
@@ -5893,17 +5933,25 @@ declare namespace _ {
*/
keyBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIteratee<T>
iteratee?: NumericDictionaryIterateeCustom<T, PropertyName>
): LoDashImplicitWrapper<Dictionary<T>>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.keyBy
*/
keyBy(
this: LoDashExplicitWrapper<string | null | undefined>,
iteratee?: StringIterator<PropertyName>
): LoDashExplicitWrapper<Dictionary<string>>;
/**
* @see _.keyBy
*/
keyBy<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
iteratee?: ListIteratee<T>
iteratee?: ListIterateeCustom<T, PropertyName>
): LoDashExplicitWrapper<Dictionary<T>>;
/**
@@ -5911,7 +5959,7 @@ declare namespace _ {
*/
keyBy<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
iteratee?: ObjectIteratee<T>
iteratee?: ObjectIterateeCustom<T, PropertyName>
): LoDashExplicitWrapper<Dictionary<T[keyof T]>>;
/**
@@ -5919,7 +5967,7 @@ declare namespace _ {
*/
keyBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
iteratee?: NumericDictionaryIteratee<T>
iteratee?: NumericDictionaryIterateeCustom<T, PropertyName>
): LoDashExplicitWrapper<Dictionary<T>>;
}
@@ -6718,7 +6766,7 @@ declare namespace _ {
*/
reject<T>(
collection: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): T[];
/**
@@ -6726,7 +6774,7 @@ declare namespace _ {
*/
reject<T extends object>(
collection: T | null | undefined,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): Array<T[keyof T]>;
}
@@ -6744,7 +6792,7 @@ declare namespace _ {
*/
reject<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): LoDashImplicitWrapper<T[]>;
/**
@@ -6752,7 +6800,7 @@ declare namespace _ {
*/
reject<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashImplicitWrapper<Array<T[keyof T]>>;
}
@@ -6770,7 +6818,7 @@ declare namespace _ {
*/
reject<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): LoDashExplicitWrapper<T[]>;
/**
@@ -6778,7 +6826,7 @@ declare namespace _ {
*/
reject<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashExplicitWrapper<Array<T[keyof T]>>;
}
@@ -6992,7 +7040,7 @@ declare namespace _ {
*/
some<T>(
collection: List<T> | null | undefined,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): boolean;
/**
@@ -7000,7 +7048,7 @@ declare namespace _ {
*/
some<T extends object>(
collection: T | null | undefined,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): boolean;
/**
@@ -7008,7 +7056,7 @@ declare namespace _ {
*/
some<T>(
collection: NumericDictionary<T> | null | undefined,
predicate?: NumericDictionaryIterateeBoolean<T>
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
}
@@ -7018,7 +7066,7 @@ declare namespace _ {
*/
some<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): boolean;
/**
@@ -7026,7 +7074,7 @@ declare namespace _ {
*/
some<T extends object>(
this: LoDashImplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): boolean;
/**
@@ -7034,7 +7082,7 @@ declare namespace _ {
*/
some<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeBoolean<T>
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): boolean;
}
@@ -7044,7 +7092,7 @@ declare namespace _ {
*/
some<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeBoolean<T>
predicate?: ListIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
/**
@@ -7052,7 +7100,7 @@ declare namespace _ {
*/
some<T extends object>(
this: LoDashExplicitWrapper<T | null | undefined>,
predicate?: ObjectIterateeBoolean<T>
predicate?: ObjectIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
/**
@@ -7060,7 +7108,7 @@ declare namespace _ {
*/
some<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: NumericDictionaryIterateeBoolean<T>
predicate?: NumericDictionaryIterateeCustom<T, boolean>
): LoDashExplicitWrapper<boolean>;
}
@@ -9315,14 +9363,16 @@ declare namespace _ {
/**
* @see _.conformsTo
*/
conformsTo(source: ConformsPredicateObject<TValue>): boolean;
conformsTo<T>(this: LoDashImplicitWrapper<T>, source: ConformsPredicateObject<T>): boolean;
// Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled.
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.conformsTo
*/
conformsTo(source: ConformsPredicateObject<TValue>): LoDashExplicitWrapper<boolean>;
conformsTo<T>(this: LoDashImplicitWrapper<T>, source: ConformsPredicateObject<T>): LoDashExplicitWrapper<boolean>;
// Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled.
}
type CondPair<T, R> = [(val: T) => boolean, (val: T) => R]
@@ -10723,7 +10773,7 @@ declare namespace _ {
/**
* @see _.toArray
*/
//toArray(): LoDashImplicitWrapper<Array<TValue[keyof TValue]>>;
toArray<T extends object>(this: LoDashImplicitWrapper<T>): LoDashImplicitWrapper<Array<T[keyof T]>>;
}
interface LoDashExplicitWrapper<TValue> {
@@ -10735,7 +10785,7 @@ declare namespace _ {
/**
* @see _.toArray
*/
//toArray(): LoDashExplicitWrapper<Array<TValue[keyof TValue]>>;
toArray<T extends object>(this: LoDashImplicitWrapper<T>): LoDashExplicitWrapper<Array<T[keyof T]>>;
}
//_.toPlainObject
@@ -17019,13 +17069,13 @@ declare namespace _ {
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, boolean> | string | [string, any] | PartialDeep<T>;
type ListIterateeCustom<T, TResult> = ListIterator<T, TResult> | 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, boolean> | string | [string, any] | PartialDeep<TObject[keyof TObject]>;
type ObjectIterateeCustom<TObject, TResult> = ObjectIterator<TObject, TResult> | 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>;
@@ -17034,7 +17084,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, boolean> | string | [string, any] | PartialDeep<T>;
type NumericDictionaryIterateeCustom<T, TResult> = NumericDictionaryIterator<T, TResult> | string | [string, any] | PartialDeep<T>;
type StringIterator<TResult> = (char: string, index: number, string: string) => TResult;
+17 -86
View File
@@ -4,86 +4,19 @@ interface IFoodOrganic {
name: string;
organic: boolean;
}
interface IFoodType {
name: string;
type: string;
}
interface IFoodCombined {
name: string;
organic: boolean;
type: string;
}
interface IStoogesQuote {
name: string;
quotes: string[];
}
interface IStoogesAge {
name: string;
age: number;
}
interface IStoogesCombined {
name: string;
age: number;
quotes: string[];
}
interface IKey {
dir: string;
code: number;
}
interface IDictionary<T> {
[index: string]: T;
}
const foodsOrganic: IFoodOrganic[] = [
{ name: 'banana', organic: true },
{ name: 'beet', organic: false },
];
const foodsType: IFoodType[] = [
{ name: 'apple', type: 'fruit' },
{ name: 'banana', type: 'fruit' },
{ name: 'beet', type: 'vegetable' }
];
const foodsCombined: IFoodCombined[] = [
{ 'name': 'apple', 'organic': false, 'type': 'fruit' },
{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }
];
const stoogesQuotes: IStoogesQuote[] = [
{ 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
{ 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] }
];
const stoogesAges: IStoogesAge[] = [
{ 'name': 'moe', 'age': 40 },
{ 'name': 'larry', 'age': 50 }
];
const stoogesAgesDict: IDictionary<IStoogesAge> = {
first: { 'name': 'moe', 'age': 40 },
second: { 'name': 'larry', 'age': 50 }
};
const stoogesCombined: IStoogesCombined[] = [
{ 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
{ 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] }
];
const keys: IKey[] = [
{ 'dir': 'left', 'code': 97 },
{ 'dir': 'right', 'code': 100 }
];
class Dog {
constructor(public name: string) { }
bark() {
// Woof
}
}
let result: any;
@@ -4591,9 +4524,9 @@ namespace TestFilter {
let obj: any = {};
let dictionary: _.Dictionary<TResult> | null | undefined = obj;
let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1;
let listIterator: (value: TResult, index: number, collection: _.List<TResult>) => any = (value: TResult, index: number, collection: _.List<TResult>) => 1;
let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary<TResult>) => any = (value: TResult, key: string, collection: _.Dictionary<TResult>) => 1;
let stringIterator = (char: string, index: number, string: string) => true;
let listIterator = (value: TResult, index: number, collection: _.List<TResult>) => true;
let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary<TResult>) => true;
{
let result: string[];
@@ -5207,7 +5140,7 @@ namespace TestFlatMapDepth {
let listIterator: (value: number|number[], index: number, collection: _.List<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) =>[ 1];
let dictionaryIterator: (value: number|number[], key: number, collection: _.Dictionary<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
let numericDictionaryIterator: (value: number|number[], key: number, collection: _.NumericDictionary<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
@@ -5776,8 +5709,8 @@ namespace TestGroupBy {
{
let result: _.Dictionary<string[]>;
result = _.groupBy<string>('');
result = _.groupBy<string>('', stringIterator);
result = _.groupBy('');
result = _.groupBy('', stringIterator);
}
{
@@ -5909,16 +5842,16 @@ namespace TestKeyBy {
let dictionary: _.Dictionary<SampleObject> | null | undefined = obj;
let numericDictionary: _.NumericDictionary<SampleObject> | null | undefined = obj;
let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1;
let listIterator: (value: SampleObject, index: number, collection: _.List<SampleObject>) => any = (value: SampleObject, index: number, collection: _.List<SampleObject>) => 1;
let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary<SampleObject>) => any = (value: SampleObject, key: string, collection: _.Dictionary<SampleObject>) => 1;
let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary<SampleObject>) => any = (value: SampleObject, key: number, collection: _.NumericDictionary<SampleObject>) => 1;
let stringIterator = (value: string, index: number, collection: string) => "a";
let listIterator = (value: SampleObject, index: number, collection: _.List<SampleObject>) => 1;
let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary<SampleObject>) => Symbol.name;
let numericDictionaryIterator = (value: SampleObject, key: number, collection: _.NumericDictionary<SampleObject>) => "a";
{
let result: _.Dictionary<string>;
result = _.keyBy<string>('abcd');
result = _.keyBy<string>('abcd', stringIterator);
result = _.keyBy('abcd');
result = _.keyBy('abcd', stringIterator);
}
{
@@ -6464,9 +6397,9 @@ namespace TestReject {
let obj: any = {};
let dictionary: _.Dictionary<TResult> | null | undefined = obj;
let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1;
let listIterator: (value: TResult, index: number, collection: _.List<TResult>) => any = (value: TResult, index: number, collection: _.List<TResult>) => 1;
let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary<TResult>) => any = (value: TResult, key: string, collection: _.Dictionary<TResult>) => 1;
let stringIterator = (char: string, index: number, string: string) => true;
let listIterator = (value: TResult, index: number, collection: _.List<TResult>) => true;
let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary<TResult>) => true;
{
let result: string[];
@@ -8667,9 +8600,7 @@ namespace TestIsEqual {
// _.isEqualWith
namespace TestIsEqualWith {
let customizer = (value: any, other: any, indexOrKey: number|string|undefined, parent: any, otherParent: any, stack: any) => {
return value ? undefined : true;
};
let customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true;
{
let result: boolean;
@@ -8873,7 +8804,7 @@ namespace TestIsMatch {
// _.isMatchWith
namespace TestIsMatchWith {
let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string) => true;
let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol) => true;
let result: boolean;