import fp = require("lodash/fp"); import _ = require("lodash"); declare const anything: any; interface AbcObject { a: number; b: string; c: boolean; } const abcObject: AbcObject = anything; const array: AbcObject[] | null | undefined = anything; const list: _.List | null | undefined = anything; const dictionary: _.Dictionary | null | undefined = anything; const numericDictionary: _.NumericDictionary | null | undefined = anything; const arrayParam: AbcObject[] = []; const listParam: _.List = []; const comparator = (a: AbcObject, b: AbcObject) => true; const listIterator = (value: AbcObject, index: number, collection: _.List) => true; const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; const valueIterator = (value: AbcObject) => true; const stringIterator = (value: string) => ""; // Wrapped array shortcut methods _([1, 2, 3, 4]).pop(); // $ExpectType number | undefined _([1, 2, 3, 4]).push(5, 6, 7); // $ExpectType LoDashImplicitWrapper _([1, 2, 3, 4]).shift(); // $ExpectType number | undefined _([1, 2, 3, 4]).sort((a, b) => 1); // $ExpectType LoDashImplicitWrapper _([1, 2, 3, 4]).splice(1); // $ExpectType LoDashImplicitWrapper _([1, 2, 3, 4]).splice(1, 2, 5, 6); // $ExpectType LoDashImplicitWrapper _([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashImplicitWrapper _.chain([1, 2, 3, 4]).pop(); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).push(5, 6, 7); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).shift(); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).sort((a, b) => 1); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).splice(1); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).splice(1, 2, 5, 6); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper /********* * Array * *********/ // _.chunk { _.chunk(list); // $ExpectType AbcObject[][] _.chunk(list, 42); // $ExpectType AbcObject[][] _(list).chunk(); // $ExpectType LoDashImplicitWrapper _(list).chunk(42); // $ExpectType LoDashImplicitWrapper _.chain(list).chunk(); // $ExpectType LoDashExplicitWrapper _.chain(list).chunk(42); // $ExpectType LoDashExplicitWrapper fp.chunk(42, list); // $ExpectType AbcObject[][] fp.chunk(42)(list); // $ExpectType AbcObject[][] fp.chunk(fp.__, list)(42); // $ExpectType AbcObject[][] } // _.compact { const list: _.List | null | undefined = anything; _.compact(list); // $ExpectType AbcObject[] _(list).compact(); // $ExpectType LoDashImplicitWrapper _.chain(list).compact(); // $ExpectType LoDashExplicitWrapper fp.compact(list); // $ExpectType AbcObject[] } // _.difference { _.difference(list); // $ExpectType AbcObject[] _.difference(list, listParam); // $ExpectType AbcObject[] _.difference(list, listParam, arrayParam, listParam); // $ExpectType AbcObject[] _(list).difference(); // $ExpectType LoDashImplicitWrapper _(list).difference(listParam); // $ExpectType LoDashImplicitWrapper _(list).difference(listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper _.chain(list).difference(); // $ExpectType LoDashExplicitWrapper _.chain(list).difference(listParam); // $ExpectType LoDashExplicitWrapper _.chain(list).difference(listParam, arrayParam, listParam); // $ExpectType LoDashExplicitWrapper fp.difference(list, arrayParam); // $ExpectType AbcObject[] fp.difference(list)(arrayParam); // $ExpectType AbcObject[] } // _.differenceBy { _.differenceBy(list); // $ExpectType AbcObject[] _.differenceBy(list, listParam); // $ExpectType AbcObject[] _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType AbcObject[] _.differenceBy(list, listParam, valueIterator); // $ExpectType AbcObject[] _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _.differenceBy(list, listParam, "a"); // $ExpectType AbcObject[] _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, "a"); _.differenceBy(list, listParam, {a: 1}); // $ExpectType AbcObject[] _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); _(list).differenceBy(listParam); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(listParam, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _(list).differenceBy(listParam, "a"); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, "a"); _(list).differenceBy(listParam, {a: 1}); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); _.chain(list).differenceBy(arrayParam); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); _.chain(list).differenceBy(arrayParam, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); _.chain(list).differenceBy(arrayParam, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); fp.differenceBy(valueIterator, list, arrayParam); // $ExpectType AbcObject[] fp.differenceBy(valueIterator)(list)(listParam); // $ExpectType AbcObject[] fp.differenceBy("a", list, arrayParam); // $ExpectType AbcObject[] fp.differenceBy({a: 1}, list, arrayParam); // $ExpectType AbcObject[] { interface T1 { a: string; b: string; } interface T2 { a: string; b: number; } interface T3 { a: string; b: boolean; } interface T4 { a: string; b: any[]; } const t1: T1 = { a: "a", b: "b" }; const t2: T2 = { a: "a", b: 30 }; const t3: T3 = { a: "a", b: true }; const t4: T4 = { a: "a", b: [] }; // $ExpectType T1[] _.differenceBy([t1], [t2], "name"); // $ExpectType T1[] _.differenceBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 return 0; }); // $ExpectType T1[] _.differenceBy([t1], [t2, t3], (value) => { value; // $ExpectType T1 | T2 | T3 return 0; }); // $ExpectType (T1 | T2)[] _.differenceBy([t1, t2], [t3], (value) => { value; // $ExpectType T1 | T2 | T3 return 0; }); // $ExpectType T1[] _.differenceBy([t1], [t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], "name"); // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], (value) => { value; // $ExpectType T1 | T2 return 0; }); // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2, t3], (value) => { value; // $ExpectType T1 | T2 | T3 return 0; }); // $ExpectType LoDashImplicitWrapper<(T1 | T2)[]> _([t1, t2]).differenceBy([t3], (value) => { value; // $ExpectType T1 | T2 | T3 return 0; }); // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], "name"); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], (value) => { value; // $ExpectType T1 | T2 return 0; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2, t3], (value) => { value; // $ExpectType T1 | T2 | T3 return 0; }); // $ExpectType LoDashExplicitWrapper<(T1 | T2)[]> _.chain([t1, t2]).differenceBy([t3], (value) => { value; // $ExpectType T1 | T2 | T3 return 0; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); fp.differenceBy("name", [t1], [t2]); // $ExpectType T1[] fp.differenceBy((value: T1 | T2) => 0, [t1], [t2]); // $ExpectType T1[] fp.differenceBy((value: T1 | T2 | T3) => 0, [t1], [t2, t3]); // $ExpectType T1[] } } // _.differenceWith { _.differenceWith(list); // $ExpectType AbcObject[] _.differenceWith(list, arrayParam, comparator); // $ExpectType AbcObject[] _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType AbcObject[] _(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashImplicitWrapper _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashImplicitWrapper _.chain(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashExplicitWrapper fp.differenceWith(comparator, list, arrayParam); // $ExpectType AbcObject[] fp.differenceWith(comparator)(list)(arrayParam); // $ExpectType AbcObject[] fp.differenceWith(comparator)(list, arrayParam); // $ExpectType AbcObject[] fp.differenceWith(comparator, list)(arrayParam); // $ExpectType AbcObject[] { interface T1 { a: string; b: string; } interface T2 { a: string; b: number; } const t1: T1 = { a: "a", b: "b" }; const t2: T2 | undefined = anything; // $ExpectType T1[] _.differenceWith([t1], [t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 | undefined return true; }); // $ExpectType LoDashImplicitWrapper _([t1]).differenceWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 | undefined return true; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 | undefined return true; }); fp.differenceWith((a: T1, b: T2 | undefined) => true, [t1], [t2]); // $ExpectType T1[] } } // _.drop // _.dropRight { _.drop(list); // $ExpectType AbcObject[] _.drop(list, 42); // $ExpectType AbcObject[] _(list).drop(42); // $ExpectType LoDashImplicitWrapper _.chain(list).drop(42); // $ExpectType LoDashExplicitWrapper fp.drop(42, list); // $ExpectType AbcObject[] fp.drop(42)(list); // $ExpectType AbcObject[] _.dropRight(list); // $ExpectType AbcObject[] _.dropRight(list, 42); // $ExpectType AbcObject[] _(list).dropRight(42); // $ExpectType LoDashImplicitWrapper _.chain(list).dropRight(42); // $ExpectType LoDashExplicitWrapper fp.dropRight(42, list); // $ExpectType AbcObject[] fp.dropRight(42)(list); // $ExpectType AbcObject[] } // _.dropWhile // _.dropRightWhile { _.dropWhile(list); // $ExpectType AbcObject[] _.dropWhile(list, listIterator); // $ExpectType AbcObject[] _.dropWhile(list, ""); // $ExpectType AbcObject[] _.dropWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropWhile(); // $ExpectType LoDashImplicitWrapper _(list).dropWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropWhile(); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile({a: 42}); // $ExpectType LoDashExplicitWrapper fp.dropWhile(valueIterator, list); // $ExpectType AbcObject[] fp.dropWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropWhile("", list); // $ExpectType AbcObject[] fp.dropWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.dropRightWhile(list); // $ExpectType AbcObject[] _.dropRightWhile(list, listIterator); // $ExpectType AbcObject[] _.dropRightWhile(list, ""); // $ExpectType AbcObject[] _.dropRightWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropRightWhile(); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropRightWhile(); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile({a: 42}); // $ExpectType LoDashExplicitWrapper fp.dropRightWhile(valueIterator, list); // $ExpectType AbcObject[] fp.dropRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropRightWhile("", list); // $ExpectType AbcObject[] fp.dropRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.fill { _.fill(array, abcObject); // $ExpectType AbcObject[] _.fill(array, abcObject, 0); // $ExpectType AbcObject[] _.fill(array, abcObject, 0, 10); // $ExpectType AbcObject[] _.fill(list, abcObject); // $ExpectType ArrayLike _.fill(list, abcObject, 0); // $ExpectType ArrayLike _.fill(list, abcObject, 0, 10); // $ExpectType ArrayLike _(list).fill(abcObject); // $ExpectType LoDashImplicitWrapper> _(list).fill(abcObject, 0); // $ExpectType LoDashImplicitWrapper> _(list).fill(abcObject, 0, 10); // $ExpectType LoDashImplicitWrapper> _.chain(list).fill(abcObject); // $ExpectType LoDashExplicitWrapper> _.chain(list).fill(abcObject, 0); // $ExpectType LoDashExplicitWrapper> _.chain(list).fill(abcObject, 0, 10); // $ExpectType LoDashExplicitWrapper> fp.fill(0, 10, abcObject, array); // $ExpectType AbcObject[] fp.fill(0)(10)(abcObject)(array); // $ExpectType AbcObject[] fp.fill(0, 10, abcObject, list); // $ExpectType ArrayLike } // _.findIndex // _.findLastIndex { _.findIndex(list); // $ExpectType number _.findIndex(list, listIterator); // $ExpectType number _.findIndex(list, ""); // $ExpectType number _.findIndex(list, {a: 42}); // $ExpectType number _.findIndex(list, listIterator, 1); // $ExpectType number _(list).findIndex(); // $ExpectType number _(list).findIndex(listIterator); // $ExpectType number _(list).findIndex(""); // $ExpectType number _(list).findIndex<{a: number}>({a: 42}); // $ExpectType number _(list).findIndex(listIterator, 1); // $ExpectType number _.chain(list).findIndex(); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper fp.findIndex(valueIterator, list); // $ExpectType number fp.findIndex(valueIterator)(list); // $ExpectType number fp.findIndex("", list); // $ExpectType number fp.findIndex({ a: 42 }, list); // $ExpectType number fp.findIndexFrom(valueIterator, 1, list); // $ExpectType number fp.findIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findIndexFrom("", 1, list); // $ExpectType number fp.findIndexFrom({ a: 42 }, 1, list); // $ExpectType number _.findLastIndex(list); // $ExpectType number _.findLastIndex(list, listIterator); // $ExpectType number _.findLastIndex(list, ""); // $ExpectType number _.findLastIndex(list, {a: 42}); // $ExpectType number _.findLastIndex(list, listIterator, 1); // $ExpectType number _(list).findLastIndex(); // $ExpectType number _(list).findLastIndex(listIterator); // $ExpectType number _(list).findLastIndex(""); // $ExpectType number _(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType number _(list).findLastIndex(listIterator, 1); // $ExpectType number _.chain(list).findLastIndex(); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper fp.findLastIndex(valueIterator, list); // $ExpectType number fp.findLastIndex(valueIterator)(list); // $ExpectType number fp.findLastIndex("", list); // $ExpectType number fp.findLastIndex({ a: 42 }, list); // $ExpectType number fp.findLastIndexFrom(valueIterator, 1, list); // $ExpectType number fp.findLastIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findLastIndexFrom("", 1, list); // $ExpectType number fp.findLastIndexFrom({ a: 42 }, 1, list); // $ExpectType number } // _.first { _.first("abc"); // $ExpectType string | undefined _.first(list); // $ExpectType AbcObject | undefined _("abc").first(); // $ExpectType string | undefined _(list).first(); // $ExpectType AbcObject | undefined _.chain("abc").first(); // $ExpectType LoDashExplicitWrapper _.chain(list).first(); // $ExpectType LoDashExplicitWrapper fp.first("abc"); // $ExpectType string | undefined fp.first(list); // $ExpectType AbcObject | undefined } // _.flatten { _.flatten("abc"); // $ExpectType string[] _.flatten([1, 2, 3]); // $ExpectType number[] _.flatten([1, [2, 3]]); // $ExpectType number[] _.flatten({0: 1, 1: [2, 3], length: 2}); // $ExpectType number[] _("abc").flatten(); // $ExpectType LoDashImplicitWrapper _([1, 2, 3]).flatten(); // $ExpectType LoDashImplicitWrapper _([1, [2, 3]]).flatten(); // $ExpectType LoDashImplicitWrapper _({0: 1, 1: [2, 3], length: 2}).flatten(); // $ExpectType LoDashImplicitWrapper _.chain("abc").flatten(); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3]).flatten(); // $ExpectType LoDashExplicitWrapper _.chain([1, [2, 3]]).flatten(); // $ExpectType LoDashExplicitWrapper _.chain({0: 1, 1: [2, 3], length: 2}).flatten(); // $ExpectType LoDashExplicitWrapper fp.flatten("abc"); // $ExpectType string[] fp.flatten([1, 2, 3]); // $ExpectType number[] fp.flatten([1, [2, 3]]); // $ExpectType number[] fp.flatten({0: 1, 1: [2, 3], length: 2}); // $ExpectType number[] fp.unnest([1, [2, 3]]); // $ExpectType number[] } // _.flattenDeep { _.flattenDeep([1, 2, 3]); // $ExpectType number[] _.flattenDeep([1, [2, [3, [4, 5]]]]); // $ExpectType number[] _.flattenDeep({0: 1, 1: [2, [3, [4, 5]]], length: 2}); // $ExpectType number[] _([1, 2, 3]).flattenDeep(); // $ExpectType LoDashImplicitWrapper _([1, [2, [3, [4, 5]]]]).flattenDeep(); // $ExpectType LoDashImplicitWrapper _({0: 1, 1: [2, [3, [4, 5]]], length: 2}).flattenDeep(); // $ExpectType LoDashImplicitWrapper _.chain([1, 2, 3]).flattenDeep(); // $ExpectType LoDashExplicitWrapper _.chain([1, [2, [3, [4, 5]]]]).flattenDeep(); // $ExpectType LoDashExplicitWrapper _.chain({0: 1, 1: [2, [3, [4, 5]]], length: 2}).flattenDeep(); // $ExpectType LoDashExplicitWrapper fp.flattenDeep([1, 2, 3]); // $ExpectType number[] fp.flattenDeep([1, [2, [3, [4, 5]]]]); // $ExpectType number[] fp.flattenDeep({0: 1, 1: [2, [3, [4, 5]]], length: 2}); // $ExpectType number[] } // _.fromPairs { const twoDimensionalArray: string[][] | null | undefined = anything; const numberTupleArray: Array<[string, number]> | null | undefined = anything; _.fromPairs(twoDimensionalArray); // $ExpectType Dictionary _.fromPairs(numberTupleArray); // $ExpectType Dictionary _(twoDimensionalArray).fromPairs(); // $ExpectType LoDashImplicitWrapper> _.chain(twoDimensionalArray).fromPairs(); // $ExpectType LoDashExplicitWrapper> fp.fromPairs(numberTupleArray); // $ExpectType Dictionary } // _.head { _.head("abc"); // $ExpectType string | undefined _.head(list); // $ExpectType AbcObject | undefined _("abc").head(); // $ExpectType string | undefined _(list).head(); // $ExpectType AbcObject | undefined _.chain("abc").head(); // $ExpectType LoDashExplicitWrapper _.chain(list).head(); // $ExpectType LoDashExplicitWrapper fp.head("abc"); // $ExpectType string | undefined fp.head(list); // $ExpectType AbcObject | undefined } // _.indexOf // _.lastIndexOf // _.sortedIndexOf // _.sortedLastIndexOf { _.indexOf(list, abcObject); // $ExpectType number _.indexOf(list, abcObject, 42); // $ExpectType number _(list).indexOf(abcObject); // $ExpectType number _(list).indexOf(abcObject, 42); // $ExpectType number _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper _.chain(list).indexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper fp.indexOf(abcObject, list); // $ExpectType number fp.indexOf(abcObject)(list); // $ExpectType number fp.indexOfFrom(abcObject)(42)(list); // $ExpectType number _.lastIndexOf(list, abcObject); // $ExpectType number _.lastIndexOf(list, abcObject, 42); // $ExpectType number _(list).lastIndexOf(abcObject); // $ExpectType number _(list).lastIndexOf(abcObject, 42); // $ExpectType number _.chain(list).lastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper _.chain(list).lastIndexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper fp.lastIndexOf(abcObject, list); // $ExpectType number fp.lastIndexOf(abcObject)(list); // $ExpectType number fp.lastIndexOfFrom(abcObject)(42)(list); // $ExpectType number _.sortedIndexOf(list, abcObject); // $ExpectType number _(list).sortedIndexOf(abcObject); // $ExpectType number _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper fp.sortedIndexOf(abcObject, list); // $ExpectType number fp.sortedIndexOf(abcObject)(list); // $ExpectType number _.sortedLastIndexOf(list, abcObject); // $ExpectType number _(list).sortedLastIndexOf(abcObject); // $ExpectType number _.chain(list).sortedLastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper fp.sortedLastIndexOf(abcObject, list); // $ExpectType number fp.sortedLastIndexOf(abcObject)(list); // $ExpectType number } // _.initial { _.initial(list); // $ExpectType AbcObject[] _(list).initial(); // $ExpectType LoDashImplicitWrapper _.chain(list).initial(); // $ExpectType LoDashExplicitWrapper fp.initial(list); // $ExpectType AbcObject[] } // _.intersection { const list: _.List = anything; _.intersection(list, list); // $ExpectType AbcObject[] _.intersection(list, list, list); // $ExpectType AbcObject[] _(list).intersection(list); // $ExpectType LoDashImplicitWrapper _(list).intersection(list, list); // $ExpectType LoDashImplicitWrapper _.chain(list).intersection(list); // $ExpectType LoDashExplicitWrapper _.chain(list).intersection(list, list); // $ExpectType LoDashExplicitWrapper fp.intersection(list, list); // $ExpectType AbcObject[] fp.intersection(list)(list); // $ExpectType AbcObject[] } // _.intersectionBy { const list: _.List = anything; _.intersectionBy(list, list); // $ExpectType AbcObject[] _.intersectionBy(list, list, list); // $ExpectType AbcObject[] _.intersectionBy(list, list, "a"); // $ExpectType AbcObject[] _.intersectionBy(list, list, list, { a: 42 }); // $ExpectType AbcObject[] _.intersectionBy(list, list, ["a", 42]); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.intersectionBy(list, list, (value) => { value; // $ExpectType AbcObject return 0; }); // $ExpectType AbcObject[] _.intersectionBy(list, list, list, (value) => { value; // $ExpectType AbcObject return 0; }); _(list).intersectionBy(list); // $ExpectType LoDashImplicitWrapper _(list).intersectionBy(list, "a"); // $ExpectType LoDashImplicitWrapper _(list).intersectionBy(list, list, { a: 42 }); // $ExpectType LoDashImplicitWrapper _(list).intersectionBy(list, ["a", 42]); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(list).intersectionBy(list, (value) => { value; // $ExpectType AbcObject return 1; }); // $ExpectType AbcObject[] _.intersectionBy(...[list], (value) => { value; // $ExpectType AbcObject return 0; }); _.chain(list).intersectionBy(list); // $ExpectType LoDashExplicitWrapper _.chain(list).intersectionBy(list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).intersectionBy(list, list, { a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(list).intersectionBy(list, ["a", 42]); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(list).intersectionBy(list, (value) => { value; // $ExpectType AbcObject return null; }); fp.intersectionBy("a", list, list); // $ExpectType AbcObject[] fp.intersectionBy("a", list, list); // $ExpectType AbcObject[] fp.intersectionBy({ a: 42 }, list, list); // $ExpectType AbcObject[] fp.intersectionBy(["a", 42], list, list); // $ExpectType AbcObject[] fp.intersectionBy((value: AbcObject) => 0, list, list); // $ExpectType AbcObject[] interface T1 { a: string; b: string; } interface T2 { a: string; b: number; } const t1: T1 = { a: "a", b: "b" }; const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] _.intersectionBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 return undefined; }); // $ExpectType LoDashImplicitWrapper _([t1]).intersectionBy([t2], (value) => { value; // $ExpectType T1 | T2 return {}; }); // $ExpectType LoDashImplicitWrapper _([t1]).intersectionBy(...[[t2]], (value) => { value; // $ExpectType T1 | T2 return {}; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).intersectionBy([t2], (value) => { value; // $ExpectType T1 | T2 return {}; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).intersectionBy(...[[t2]], (value) => { value; // $ExpectType T1 | T2 return {}; }); } // _.intersectionWith { const list: _.List = anything; _.intersectionWith(list, list); // $ExpectType AbcObject[] _.intersectionWith(list, list, list); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.intersectionWith(list, list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); // $ExpectType AbcObject[] _.intersectionWith(list, list, list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); _(list).intersectionWith(list); // $ExpectType LoDashImplicitWrapper _(list).intersectionWith(list, list); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(list).intersectionWith(list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); _.chain(list).intersectionWith(list); // $ExpectType LoDashExplicitWrapper _.chain(list).intersectionWith(list, list); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(list).intersectionWith(list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); fp.intersectionWith((a: AbcObject, b: AbcObject) => true, list, list); // $ExpectType AbcObject[] fp.intersectionWith((a: AbcObject, b: AbcObject) => true)(list)(list); // $ExpectType AbcObject[] interface T1 { a: string; b: string; } interface T2 { a: string; b: number; } const t1: T1 = { a: "a", b: "b" }; const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] _.intersectionWith([t1], [t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashImplicitWrapper _([t1]).intersectionWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).intersectionWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); fp.intersectionWith((a: T1, b: T2) => true)([t1])([t2]); // $ExpectType T1[] } // _.join { const list: _.List | null | undefined = anything; _.join("abc"); // $ExpectType string _.join("abc", "_"); // $ExpectType string _.join(list); // $ExpectType string _.join(list, "_"); // $ExpectType string _("abc").join(); // $ExpectType string _("abc").join("_"); // $ExpectType string _(list).join(); // $ExpectType string _(list).join("_"); // $ExpectType string _.chain("abc").join(); // $ExpectType LoDashExplicitWrapper _.chain("abc").join("_"); // $ExpectType LoDashExplicitWrapper _.chain(list).join(); // $ExpectType LoDashExplicitWrapper _.chain(list).join("_"); // $ExpectType LoDashExplicitWrapper fp.join("_", "abc"); // $ExpectType string fp.join("_")(list); // $ExpectType string } // _.last { _.last("abc"); // $ExpectType string | undefined _.last(list); // $ExpectType AbcObject | undefined _("abc").last(); // $ExpectType string | undefined _(list).last(); // $ExpectType AbcObject | undefined _.chain("abc").last(); // $ExpectType LoDashExplicitWrapper _.chain(list).last(); // $ExpectType LoDashExplicitWrapper fp.last("abc"); // $ExpectType string | undefined fp.last(list); // $ExpectType AbcObject | undefined } // _.nth { _.nth(list, 42); // $ExpectType AbcObject | undefined _(list).nth(42); // $ExpectType AbcObject | undefined _.chain(list).nth(42); // $ExpectType LoDashExplicitWrapper fp.nth(42, list); // $ExpectType AbcObject | undefined fp.nth(42)(list); // $ExpectType AbcObject | undefined } // _.pull { const array: AbcObject[] = []; const list: _.List = []; _.pull(array); // $ExpectType AbcObject[] _.pull(array, abcObject); // $ExpectType AbcObject[] _.pull(array, abcObject, abcObject, abcObject); // $ExpectType AbcObject[] _.pull(list); // $ExpectType ArrayLike _.pull(list, abcObject); // $ExpectType ArrayLike _.pull(list, abcObject, abcObject, abcObject); // $ExpectType ArrayLike _(array).pull(); // $ExpectType LoDashImplicitWrapper _(array).pull(abcObject); // $ExpectType LoDashImplicitWrapper _(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper _(list).pull(); // $ExpectType LoDashImplicitWrapper> _(list).pull(abcObject); // $ExpectType LoDashImplicitWrapper> _(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper> _.chain(array).pull(); // $ExpectType LoDashExplicitWrapper _.chain(array).pull(abcObject); // $ExpectType LoDashExplicitWrapper _.chain(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper _.chain(list).pull(); // $ExpectType LoDashExplicitWrapper> _.chain(list).pull(abcObject); // $ExpectType LoDashExplicitWrapper> _.chain(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper> fp.pull(abcObject, array); // $ExpectType AbcObject[] fp.pull(abcObject)(list); // $ExpectType ArrayLike } // _.pullAt { const array: AbcObject[] = []; const list: _.List = []; _.pullAt(array); // $ExpectType AbcObject[] _.pullAt(array, 1); // $ExpectType AbcObject[] _.pullAt(array, [2, 3], 4); // $ExpectType AbcObject[] _.pullAt(list); // $ExpectType ArrayLike _.pullAt(list, 1); // $ExpectType ArrayLike _.pullAt(list, [2, 3], 4); // $ExpectType ArrayLike _(array).pullAt(); // $ExpectType LoDashImplicitWrapper _(array).pullAt(1); // $ExpectType LoDashImplicitWrapper _(array).pullAt([2, 3], 4); // $ExpectType LoDashImplicitWrapper _(list).pullAt(); // $ExpectType LoDashImplicitWrapper> _(list).pullAt(1); // $ExpectType LoDashImplicitWrapper> _(list).pullAt([2, 3], 4); // $ExpectType LoDashImplicitWrapper> _.chain(array).pullAt(); // $ExpectType LoDashExplicitWrapper _.chain(array).pullAt(1); // $ExpectType LoDashExplicitWrapper _.chain(array).pullAt([2, 3], 4); // $ExpectType LoDashExplicitWrapper _.chain(list).pullAt(); // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAt(1); // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAt([2, 3], 4); // $ExpectType LoDashExplicitWrapper> fp.pullAt(1, array); // $ExpectType AbcObject[] fp.pullAt([2, 3], array); // $ExpectType AbcObject[] fp.pullAt(1, list); // $ExpectType ArrayLike fp.pullAt([2, 3], list); // $ExpectType ArrayLike fp.pullAt(1)(list); // $ExpectType ArrayLike } // _.pullAll { const array: AbcObject[] = anything; const list: _.List = anything; const values: _.List = anything; _.pullAll(array); // $ExpectType AbcObject[] _.pullAll(array, values); // $ExpectType AbcObject[] _.pullAll(list); // $ExpectType ArrayLike _.pullAll(list, values); // $ExpectType ArrayLike _(array).pullAll(); // $ExpectType LoDashImplicitWrapper _(array).pullAll(values); // $ExpectType LoDashImplicitWrapper _(list).pullAll(); // $ExpectType LoDashImplicitWrapper> _(list).pullAll(values); // $ExpectType LoDashImplicitWrapper> _.chain(array).pullAll(); // $ExpectType LoDashExplicitWrapper _.chain(array).pullAll(values); // $ExpectType LoDashExplicitWrapper _.chain(list).pullAll(); // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAll(values); // $ExpectType LoDashExplicitWrapper> fp.pullAll(values, array); // $ExpectType AbcObject[] fp.pullAll(values, list); // $ExpectType ArrayLike fp.pullAll(values)(list); // $ExpectType ArrayLike } // _.pullAllBy // _.pullAllWith { const array: AbcObject[] = anything; const list: _.List = anything; const values: _.List = anything; _.pullAllBy(array); // $ExpectType AbcObject[] _.pullAllBy(array, values, "a"); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.pullAllBy(array, values, (value) => { value; // $ExpectType AbcObject return []; }); _.pullAllBy(list); // $ExpectType ArrayLike _.pullAllBy(list, values); // $ExpectType ArrayLike _.pullAllBy(list, values, "a"); // $ExpectType ArrayLike _.pullAllBy(list, values, { a: 42 }); // $ExpectType ArrayLike _.pullAllBy(list, values, ["a", 42]); // $ExpectType ArrayLike // $ExpectType ArrayLike _.pullAllBy(list, values, (value) => { value; // $ExpectType AbcObject return () => {}; }); _(array).pullAllBy(); // $ExpectType LoDashImplicitWrapper _(array).pullAllBy(values, "a"); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(array).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); _(list).pullAllBy(); // $ExpectType LoDashImplicitWrapper> _(list).pullAllBy(values, "a"); // $ExpectType LoDashImplicitWrapper> // $ExpectType LoDashImplicitWrapper> _(list).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); _.chain(array).pullAllBy(); // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllBy(values, "a"); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); _.chain(list).pullAllBy(); // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAllBy(values, "a"); // $ExpectType LoDashExplicitWrapper> // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); fp.pullAllBy("a", values, array); // $ExpectType AbcObject[] fp.pullAllBy({ a: 42 }, values, array); // $ExpectType AbcObject[] fp.pullAllBy(["a", 42], values, array); // $ExpectType AbcObject[] fp.pullAllBy((value: AbcObject) => true, values, array); // $ExpectType AbcObject[] fp.pullAllBy((value: AbcObject) => true)(values, array); // $ExpectType AbcObject[] fp.pullAllBy((value: AbcObject) => true, values)(array); // $ExpectType AbcObject[] fp.pullAllBy((value: AbcObject) => true)(values)(array); // $ExpectType AbcObject[] fp.pullAllBy("a", values, list); // $ExpectType ArrayLike fp.pullAllBy({ a: 42 }, values, list); // $ExpectType ArrayLike fp.pullAllBy(["a", 42], values, list); // $ExpectType ArrayLike fp.pullAllBy((value: AbcObject) => true, values, list); // $ExpectType ArrayLike fp.pullAllBy((value: AbcObject) => true)(values, list); // $ExpectType ArrayLike fp.pullAllBy((value: AbcObject) => true, values)(list); // $ExpectType ArrayLike fp.pullAllBy((value: AbcObject) => true)(values)(list); // $ExpectType ArrayLike interface T1 { a: string; b: string; } interface T2 { a: string; b: number; } const t1: T1 = { a: "a", b: "b" }; const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] _.pullAllBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); // $ExpectType LoDashImplicitWrapper _([t1]).pullAllBy([t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).pullAllBy([t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); fp.pullAllBy((value: T1 | T2) => value.a, [t2], [t1]); // $ExpectType T1[] fp.pullAllBy((value: T1 | T2) => value.a)([t2])([t1]); // $ExpectType (T1 | T2)[] _.pullAllWith(array); // $ExpectType AbcObject[] _.pullAllWith(array, values); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.pullAllWith(array, values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); _.pullAllWith(list); // $ExpectType ArrayLike // $ExpectType ArrayLike _.pullAllWith(list, values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); _(array).pullAllWith(); // $ExpectType LoDashImplicitWrapper _(array).pullAllWith(values); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(array).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); _(list).pullAllWith(); // $ExpectType LoDashImplicitWrapper> // $ExpectType LoDashImplicitWrapper> _(list).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); _.chain(array).pullAllWith(); // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllWith(values); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); _.chain(list).pullAllWith(); // $ExpectType LoDashExplicitWrapper> // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); fp.pullAllWith((a, b) => true, values, array); // $ExpectType AbcObject[] fp.pullAllWith((a: AbcObject, b: AbcObject) => true)(values, array); // $ExpectType AbcObject[] fp.pullAllWith((a, b) => true, values, list); // $ExpectType ArrayLike fp.pullAllWith((a: AbcObject, b: AbcObject) => true)(values, list); // $ExpectType ArrayLike // $ExpectType T1[] _.pullAllWith([t1], [t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashImplicitWrapper _([t1]).pullAllWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashExplicitWrapper _.chain([t1]).pullAllWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); fp.pullAllWith((a, b) => a.a === b.a, [t2], [t1]); // $ExpectType T1[] fp.pullAllWith((a: T1, b: T2) => a.a === b.a)([t2], [t1]); // $ExpectType T1[] } // _.remove { const list: _.List = []; _.remove(list); // $ExpectType AbcObject[] _.remove(list, listIterator); // $ExpectType AbcObject[] _.remove(list, ""); // $ExpectType AbcObject[] _.remove(list, { a: 42 }); // $ExpectType AbcObject[] _(list).remove(); // $ExpectType LoDashImplicitWrapper _(list).remove(listIterator); // $ExpectType LoDashImplicitWrapper _(list).remove(""); // $ExpectType LoDashImplicitWrapper _(list).remove({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).remove(); // $ExpectType LoDashExplicitWrapper _.chain(list).remove(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).remove(""); // $ExpectType LoDashExplicitWrapper _.chain(list).remove({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.remove(valueIterator, list); // $ExpectType AbcObject[] fp.remove(valueIterator)(list); // $ExpectType AbcObject[] fp.remove("", list); // $ExpectType AbcObject[] fp.remove({ a: 42 }, list); // $ExpectType AbcObject[] } // _.tail { _.tail(list); // $ExpectType AbcObject[] _(list).tail(); // $ExpectType LoDashImplicitWrapper _.chain(list).tail(); // $ExpectType LoDashExplicitWrapper fp.tail(list); // $ExpectType AbcObject[] } // _.slice { _.slice(array); // $ExpectType AbcObject[] _.slice(array, 42); // $ExpectType AbcObject[] _.slice(array, 42, 42); // $ExpectType AbcObject[] _(array).slice(); // $ExpectType LoDashImplicitWrapper _(array).slice(42, 42); // $ExpectType LoDashImplicitWrapper _.chain(array).slice(); // $ExpectType LoDashExplicitWrapper _.chain(array).slice(42, 42); // $ExpectType LoDashExplicitWrapper fp.slice(0, 10, array); // $ExpectType AbcObject[] fp.slice(0)(10, array); // $ExpectType AbcObject[] fp.slice(0)(10)(array); // $ExpectType AbcObject[] } // _.sortedIndexBy // _.sortedLastIndexBy { _.sortedIndexBy(list, abcObject, valueIterator); // $ExpectType number _.sortedIndexBy(list, abcObject, ""); // $ExpectType number _.sortedIndexBy(list, abcObject, { a: 42 }); // $ExpectType number _(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType number _(list).sortedIndexBy(abcObject, ""); // $ExpectType number _(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType number _.chain(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).sortedIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper _.chain(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper fp.sortedIndexBy(valueIterator, abcObject, list); // $ExpectType number fp.sortedIndexBy(valueIterator)(abcObject)(list); // $ExpectType number fp.sortedIndexBy("a", abcObject, list); // $ExpectType number fp.sortedIndexBy({ a: 42 }, abcObject, list); // $ExpectType number _.sortedLastIndexBy(list, abcObject, valueIterator); // $ExpectType number _.sortedLastIndexBy(list, abcObject, ""); // $ExpectType number _.sortedLastIndexBy(list, abcObject, { a: 42 }); // $ExpectType number _(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType number _(list).sortedLastIndexBy(abcObject, ""); // $ExpectType number _(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType number _.chain(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).sortedLastIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper _.chain(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper fp.sortedLastIndexBy(valueIterator, abcObject, list); // $ExpectType number fp.sortedLastIndexBy(valueIterator)(abcObject)(list); // $ExpectType number fp.sortedLastIndexBy("a", abcObject, list); // $ExpectType number fp.sortedLastIndexBy({ a: 42 }, abcObject, list); // $ExpectType number } // _.sortedIndex // _.sortedLastIndex { _.sortedIndex(list, abcObject); // $ExpectType number _(list).sortedIndex(abcObject); // $ExpectType number _.chain(list).sortedIndex(abcObject); // $ExpectType LoDashExplicitWrapper fp.sortedIndex(abcObject, list); // $ExpectType number fp.sortedIndex(abcObject)(list); // $ExpectType number _.sortedLastIndex(list, abcObject); // $ExpectType number _(list).sortedLastIndex(abcObject); // $ExpectType number _.chain(list).sortedLastIndex(abcObject); // $ExpectType LoDashExplicitWrapper fp.sortedLastIndex(abcObject, list); // $ExpectType number fp.sortedLastIndex(abcObject)(list); // $ExpectType number } // _.take // _.takeRight { _.take(list); // $ExpectType AbcObject[] _.take(list, 42); // $ExpectType AbcObject[] _(list).take(); // $ExpectType LoDashImplicitWrapper _(list).take(42); // $ExpectType LoDashImplicitWrapper _.chain(list).take(); // $ExpectType LoDashExplicitWrapper _.chain(list).take(42); // $ExpectType LoDashExplicitWrapper fp.take(42, list); // $ExpectType AbcObject[] fp.take(42)(list); // $ExpectType AbcObject[] _.takeRight(list); // $ExpectType AbcObject[] _.takeRight(list, 42); // $ExpectType AbcObject[] _(list).takeRight(); // $ExpectType LoDashImplicitWrapper _(list).takeRight(42); // $ExpectType LoDashImplicitWrapper _.chain(list).takeRight(); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRight(42); // $ExpectType LoDashExplicitWrapper fp.takeRight(42, list); // $ExpectType AbcObject[] fp.takeRight(42)(list); // $ExpectType AbcObject[] } // _.takeWhile // _.takeRightWhile { _.takeWhile(list); // $ExpectType AbcObject[] _.takeWhile(list, listIterator); // $ExpectType AbcObject[] _.takeWhile(list, ""); // $ExpectType AbcObject[] _.takeWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeWhile(); // $ExpectType LoDashImplicitWrapper _(list).takeWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeWhile(); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.takeWhile(valueIterator, list); // $ExpectType AbcObject[] fp.takeWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeWhile("a", list); // $ExpectType AbcObject[] fp.takeWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.takeRightWhile(list); // $ExpectType AbcObject[] _.takeRightWhile(list, listIterator); // $ExpectType AbcObject[] _.takeRightWhile(list, ""); // $ExpectType AbcObject[] _.takeRightWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeRightWhile(); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeRightWhile(); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.takeRightWhile(valueIterator, list); // $ExpectType AbcObject[] fp.takeRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeRightWhile("a", list); // $ExpectType AbcObject[] fp.takeRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.union { _.union(list); // $ExpectType AbcObject[] _.union(list, list); // $ExpectType AbcObject[] _.union(list, list, list); // $ExpectType AbcObject[] _(list).union(); // $ExpectType LoDashImplicitWrapper _(list).union(list); // $ExpectType LoDashImplicitWrapper _(list).union(list, list); // $ExpectType LoDashImplicitWrapper _.chain(list).union(); // $ExpectType LoDashExplicitWrapper _.chain(list).union(list); // $ExpectType LoDashExplicitWrapper _.chain(list).union(list, list); // $ExpectType LoDashExplicitWrapper fp.union(list, list); // $ExpectType AbcObject[] fp.union(list)(list); // $ExpectType AbcObject[] } // _.unionBy { _.unionBy(list, list); // $ExpectType AbcObject[] _.unionBy(list, list, valueIterator); // $ExpectType AbcObject[] _.unionBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.unionBy(list, list, "a"); // $ExpectType AbcObject[] _.unionBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] _.unionBy(list, list, {a: 1}); // $ExpectType AbcObject[] _.unionBy(list, list, list, list, list, list, {a: 1}); // $ExpectType AbcObject[] _(list).unionBy(list); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, "a"); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, {a: 1}); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashImplicitWrapper _.chain(list).unionBy(list); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper fp.unionBy(valueIterator, list, list); // $ExpectType AbcObject[] fp.unionBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.unionBy("a", list, list); // $ExpectType AbcObject[] fp.unionBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.uniq // _.sortedUniq { _.uniq("abc"); // $ExpectType string[] _.uniq(list); // $ExpectType AbcObject[] _(list).uniq(); // $ExpectType LoDashImplicitWrapper _.chain(list).uniq(); // $ExpectType LoDashExplicitWrapper fp.uniq("abc"); // $ExpectType string[] fp.uniq(list); // $ExpectType AbcObject[] _.sortedUniq("abc"); // $ExpectType string[] _.sortedUniq(list); // $ExpectType AbcObject[] _(list).sortedUniq(); // $ExpectType LoDashImplicitWrapper _.chain(list).sortedUniq(); // $ExpectType LoDashExplicitWrapper fp.sortedUniq("abc"); // $ExpectType string[] fp.sortedUniq(list); // $ExpectType AbcObject[] } // _.uniqBy // _.sortedUniqBy { _.uniqBy("abc", stringIterator); // $ExpectType string[] _.uniqBy(list, valueIterator); // $ExpectType AbcObject[] _.uniqBy(list, "a"); // $ExpectType AbcObject[] _(list).uniqBy(valueIterator); // $ExpectType LoDashImplicitWrapper _(list).uniqBy("a"); // $ExpectType LoDashImplicitWrapper _.chain(list).uniqBy(valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).uniqBy("a"); // $ExpectType LoDashExplicitWrapper fp.uniqBy(stringIterator, "abc"); // $ExpectType string[] fp.uniqBy(valueIterator, list); // $ExpectType AbcObject[] fp.uniqBy(valueIterator)(list); // $ExpectType AbcObject[] fp.uniqBy("a", list); // $ExpectType AbcObject[] _.sortedUniqBy("abc", stringIterator); // $ExpectType string[] _.sortedUniqBy(list, valueIterator); // $ExpectType AbcObject[] _.sortedUniqBy(list, "a"); // $ExpectType AbcObject[] _(list).sortedUniqBy(valueIterator); // $ExpectType LoDashImplicitWrapper _(list).sortedUniqBy("a"); // $ExpectType LoDashImplicitWrapper _.chain(list).sortedUniqBy(valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).sortedUniqBy("a"); // $ExpectType LoDashExplicitWrapper fp.sortedUniqBy(stringIterator, "abc"); // $ExpectType string[] fp.sortedUniqBy(valueIterator, list); // $ExpectType AbcObject[] fp.sortedUniqBy(valueIterator)(list); // $ExpectType AbcObject[] fp.sortedUniqBy("a", list); // $ExpectType AbcObject[] } // _.unzip { const list: _.List<_.List> | null | undefined = anything; _.unzip(list); // $ExpectType AbcObject[][] _(list).unzip(); // $ExpectType LoDashImplicitWrapper _.chain(list).unzip(); // $ExpectType LoDashExplicitWrapper fp.unzip(list); // $ExpectType AbcObject[][] } // _.unzipWith { const list: _.List<_.List> | null | undefined = anything; _.unzipWith(list); // $ExpectType AbcObject[][] // $ExpectType number[] _.unzipWith(list, (...group) => { group; // $ExpectType AbcObject[] return 1; }); // $ExpectType boolean[] _.unzipWith(list, (value1, value2, value3) => { value1; // $ExpectType AbcObject value2; // $ExpectType AbcObject value3; // $ExpectType AbcObject return true; }); _(list).unzipWith(); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(list).unzipWith((...group) => { group; // $ExpectType AbcObject[] return 1; }); _.chain(list).unzipWith(); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(list).unzipWith((...group) => { group; // $ExpectType AbcObject[] return 1; }); fp.unzipWith((...group: AbcObject[]) => 1, list); // $ExpectType number[] fp.unzipWith((...group: AbcObject[]) => 1)(list); // $ExpectType number[] } // _.without { const list: _.List | null | undefined = anything; _.without(list); // $ExpectType number[] _.without(list, 1); // $ExpectType number[] _.without(list, 1, 2, 3); // $ExpectType number[] _(list).without(); // $ExpectType LoDashImplicitWrapper _(list).without(1); // $ExpectType LoDashImplicitWrapper _(list).without(1, 2, 3); // $ExpectType LoDashImplicitWrapper _.chain(list).without(); // $ExpectType LoDashExplicitWrapper _.chain(list).without(1); // $ExpectType LoDashExplicitWrapper _.chain(list).without(1, 2, 3); // $ExpectType LoDashExplicitWrapper fp.without([1, 2], list); fp.without([1, 2])(list); } // _.xor { _.xor(list); // $ExpectType AbcObject[] _.xor(list, list); // $ExpectType AbcObject[] _.xor(list, list, list); // $ExpectType AbcObject[] _(list).xor(); // $ExpectType LoDashImplicitWrapper _(list).xor(list); // $ExpectType LoDashImplicitWrapper _(list).xor(list, list); // $ExpectType LoDashImplicitWrapper _.chain(list).xor(); // $ExpectType LoDashExplicitWrapper _.chain(list).xor(list); // $ExpectType LoDashExplicitWrapper _.chain(list).xor(list, list); // $ExpectType LoDashExplicitWrapper fp.xor(list, list); // $ExpectType AbcObject[] fp.xor(list)(list); // $ExpectType AbcObject[] } // _.xorBy { _.xorBy(list, list); // $ExpectType AbcObject[] _.xorBy(list, list, valueIterator); // $ExpectType AbcObject[] _.xorBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.xorBy(list, list, "a"); // $ExpectType AbcObject[] _.xorBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] _.xorBy(list, list, {a: 1}); // $ExpectType AbcObject[] _.xorBy(list, list, list, list, list, list, {a: 1}); // $ExpectType AbcObject[] _(list).xorBy(list); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, "a"); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, {a: 1}); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashImplicitWrapper _.chain(list).xorBy(list); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper fp.xorBy(valueIterator, list, list); // $ExpectType AbcObject[] fp.xorBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.xorBy("a", list, list); // $ExpectType AbcObject[] fp.xorBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.zip { _.zip(list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list, list, list, list, list); // $ExpectType (AbcObject | undefined)[][] _.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][] _.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][] _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][] _(list).zip(list); // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> _(list).zip(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> _.chain(list).zip(list); // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> _.chain(list).zip(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> const list2: _.List = anything; fp.zip(list2, list2); // $ExpectType [AbcObject | undefined, AbcObject | undefined][] fp.zip(list2)(list2); // $ExpectType [AbcObject | undefined, AbcObject | undefined][] fp.zip(["a", "b"], [1, 2]); // $ExpectType [string | undefined, number | undefined][] fp.zipAll([list2, list2, list2]); // $ExpectType (AbcObject | undefined)[][] fp.zipAll([[1, 2], ["a", "b"], [true, false]]); // $ExpectType (string | number | boolean | undefined)[][] } // _.zipObject // _.zipObjectDeep { const listOfKeys: _.List = anything; const listOfValues: _.List = anything; _.zipObject(["a", "b"], [1, 2]); // $ExpectType Dictionary _.zipObject(listOfKeys, listOfValues); // $ExpectType Dictionary _(listOfKeys).zipObject(listOfValues); // $ExpectType LoDashImplicitWrapper> _.chain(listOfKeys).zipObject(listOfValues); // $ExpectType LoDashExplicitWrapper> fp.zipObject(["a", "b"], [1, 2]); // $ExpectType Dictionary fp.zipObject(listOfKeys)(listOfValues); // $ExpectType Dictionary _.zipObjectDeep(["a.b[0].c", "a.b[1].d"], [1, 2]); // $ExpectType object _.zipObjectDeep(listOfKeys, listOfValues); // $ExpectType object _(listOfKeys).zipObjectDeep(listOfValues); // $ExpectType LoDashImplicitWrapper _.chain(listOfKeys).zipObjectDeep(listOfValues); // $ExpectType LoDashExplicitWrapper fp.zipObjectDeep(["a.b[0].c", "a.b[1].d"], [1, 2]); // $ExpectType object fp.zipObjectDeep(listOfKeys)(listOfValues); // $ExpectType object } // _.zipWith { // $ExpectType string[] _.zipWith([1, 2], (value1) => { value1; // $ExpectType number return ""; }); // $ExpectType string[] _.zipWith([1, 2], [1, 2], (value1, value2) => { value1; // $ExpectType number value2; // $ExpectType number return ""; }); // $ExpectType string[] _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { value1; // $ExpectType number value2; // $ExpectType number value3; // $ExpectType number value4; // $ExpectType number value5; // $ExpectType number value6; // $ExpectType number return ""; }); // $ExpectType string[] _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { group; // $ExpectType number[] return ""; }); // $ExpectType string[] _.zipWith([1, 2], ["a", "b"], [true, false], (value1, value2, value3) => { value1; // $ExpectType number value2; // $ExpectType string value3; // $ExpectType boolean return ""; }); const values = [[1, 2], [1, 2], [1, 2]]; _.zipWith(...values, (...group: number[]) => ""); // $ExpectType string[] // $ExpectType LoDashImplicitWrapper _([1, 2]).zipWith((value1) => { value1; // $ExpectType number return ""; }); // $ExpectType LoDashImplicitWrapper _([1, 2]).zipWith([1, 2], (value1, value2) => { value1; // $ExpectType number value2; // $ExpectType number return ""; }); // $ExpectType LoDashImplicitWrapper _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { group; // $ExpectType number[] return ""; }); // $ExpectType LoDashImplicitWrapper _([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { value1; // $ExpectType number value2; // $ExpectType string value3; // $ExpectType boolean return ""; }); // $ExpectType LoDashExplicitWrapper _.chain([1, 2]).zipWith((value1) => { value1; // $ExpectType number return ""; }); // $ExpectType LoDashExplicitWrapper _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { group; // $ExpectType number[] return ""; }); // $ExpectType LoDashExplicitWrapper _.chain([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { value1; // $ExpectType number value2; // $ExpectType string value3; // $ExpectType boolean return ""; }); fp.zipWith((value1, value2) => "a", [1, 2], [1, 2]); // $ExpectType string[] fp.zipWith((value1: number, value2: number) => "a")([1, 2])([1, 2]); // $ExpectType string[] } /************** * Collection * **************/ // _.at { const abcObject: AbcObject | null | undefined = anything; _.at(list, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] _.at(numericDictionary, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] _.at(dictionary, "a", ["b", "c"]); // $ExpectType AbcObject[] _.at(abcObject, "a", ["b", "c"]); // $ExpectType (string | number | boolean)[] _(list).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashImplicitWrapper _(numericDictionary).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashImplicitWrapper _(dictionary).at("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper _(abcObject).at("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper<(string | number | boolean)[]> _.chain(list).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).at("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper _.chain(abcObject).at("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper<(string | number | boolean)[]> fp.at(0, list); // $ExpectType AbcObject[] fp.at(0)(list); // $ExpectType AbcObject[] fp.at([0, "1"], list); // $ExpectType AbcObject[] fp.at("a", abcObject); // $ExpectType (string | number | boolean)[] } // _.countBy { _.countBy(""); // $ExpectType Dictionary _.countBy("", stringIterator); // $ExpectType Dictionary _.countBy(list); // $ExpectType Dictionary _.countBy(list, valueIterator); // $ExpectType Dictionary _.countBy(list, ""); // $ExpectType Dictionary _.countBy(list, { a: 42 }); // $ExpectType Dictionary _.countBy(dictionary); // $ExpectType Dictionary _.countBy(dictionary, valueIterator); // $ExpectType Dictionary _.countBy(dictionary, ""); // $ExpectType Dictionary _.countBy(dictionary, { a: 42 }); // $ExpectType Dictionary _.countBy(numericDictionary); // $ExpectType Dictionary _.countBy(numericDictionary, valueIterator); // $ExpectType Dictionary _.countBy(numericDictionary, ""); // $ExpectType Dictionary _.countBy(numericDictionary, { a: 42 }); // $ExpectType Dictionary _("").countBy(); // $ExpectType LoDashImplicitWrapper> _("").countBy(stringIterator); // $ExpectType LoDashImplicitWrapper> _(list).countBy(); // $ExpectType LoDashImplicitWrapper> _(list).countBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(list).countBy(""); // $ExpectType LoDashImplicitWrapper> _(list).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _(dictionary).countBy(); // $ExpectType LoDashImplicitWrapper> _(dictionary).countBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(dictionary).countBy(""); // $ExpectType LoDashImplicitWrapper> _(dictionary).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).countBy(); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).countBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).countBy(""); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _.chain("").countBy(); // $ExpectType LoDashExplicitWrapper> _.chain("").countBy(stringIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).countBy(); // $ExpectType LoDashExplicitWrapper> _.chain(list).countBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).countBy(""); // $ExpectType LoDashExplicitWrapper> _.chain(list).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).countBy(); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).countBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).countBy(""); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).countBy(); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).countBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).countBy(""); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> fp.countBy(stringIterator, ""); // $ExpectType Dictionary fp.countBy(stringIterator)(""); // $ExpectType Dictionary fp.countBy(valueIterator, list); // $ExpectType Dictionary fp.countBy("", list); // $ExpectType Dictionary fp.countBy({ a: 42 }, list); // $ExpectType Dictionary fp.countBy(valueIterator, dictionary); // $ExpectType Dictionary fp.countBy({ a: 42 }, dictionary); // $ExpectType Dictionary fp.countBy(valueIterator, numericDictionary); // $ExpectType Dictionary fp.countBy({ a: 42 }, numericDictionary); // $ExpectType Dictionary } // _.every { _.every(list); // $ExpectType boolean _.every(list, listIterator); // $ExpectType boolean _.every(list, "a"); // $ExpectType boolean _.every(list, ["a", 42]); // $ExpectType boolean _.every(list, { a: 42 }); // $ExpectType boolean _.every(dictionary); // $ExpectType boolean _.every(dictionary, dictionaryIterator); // $ExpectType boolean _.every(dictionary, "a"); // $ExpectType boolean _.every(dictionary, ["a", 42]); // $ExpectType boolean _.every(dictionary, { a: 42 }); // $ExpectType boolean _.every(numericDictionary); // $ExpectType boolean _.every(numericDictionary, numericDictionaryIterator); // $ExpectType boolean _.every(numericDictionary, "a"); // $ExpectType boolean _.every(numericDictionary, ["a", 42]); // $ExpectType boolean _.every(numericDictionary, { a: 42 }); // $ExpectType boolean _(list).every(); // $ExpectType boolean _(list).every(listIterator); // $ExpectType boolean _(list).every("a"); // $ExpectType boolean _(list).every(["a", 42]); // $ExpectType boolean _(list).every({ a: 42 }); // $ExpectType boolean _(dictionary).every(); // $ExpectType boolean _(dictionary).every(dictionaryIterator); // $ExpectType boolean _(dictionary).every("a"); // $ExpectType boolean _(dictionary).every(["a", 42]); // $ExpectType boolean _(dictionary).every({ a: 42 }); // $ExpectType boolean _(numericDictionary).every(); // $ExpectType boolean _(numericDictionary).every(numericDictionaryIterator); // $ExpectType boolean _(numericDictionary).every("a"); // $ExpectType boolean _(numericDictionary).every(["a", 42]); // $ExpectType boolean _(numericDictionary).every({ a: 42 }); // $ExpectType boolean _.chain(list).every(); // $ExpectType LoDashExplicitWrapper _.chain(list).every(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).every("a"); // $ExpectType LoDashExplicitWrapper _.chain(list).every(["a", 42]); // $ExpectType LoDashExplicitWrapper _.chain(list).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).every(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).every(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).every("a"); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).every(["a", 42]); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).every(); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).every(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).every("a"); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).every(["a", 42]); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.every(valueIterator, list); // $ExpectType boolean fp.every("a")(list); // $ExpectType boolean fp.every({ a: 42 }, list); // $ExpectType boolean fp.every(["a", 42], list); // $ExpectType boolean fp.every(valueIterator, dictionary); // $ExpectType boolean fp.every("a")(dictionary); // $ExpectType boolean fp.every({ a: 42 })(dictionary); // $ExpectType boolean fp.every(["a", 42])(dictionary); // $ExpectType boolean fp.every(valueIterator, numericDictionary); // $ExpectType boolean fp.every("a")(numericDictionary); // $ExpectType boolean fp.every({ a: 42 })(numericDictionary); // $ExpectType boolean fp.every(["a", 42])(numericDictionary); // $ExpectType boolean } // _.filter { const stringIterator = (char: string, index: number, string: string) => true; _.filter("", stringIterator); // $ExpectType string[] _.filter(list, listIterator); // $ExpectType AbcObject[] _.filter(list, ""); // $ExpectType AbcObject[] _.filter(list, { a: 42 }); // $ExpectType AbcObject[] _.filter(list, ["a", 42]); // $ExpectType AbcObject[] _.filter(dictionary, dictionaryIterator); // $ExpectType AbcObject[] _.filter(dictionary, ""); // $ExpectType AbcObject[] _.filter(dictionary, { a: 42 }); // $ExpectType AbcObject[] _.filter(dictionary, ["a", 42]); // $ExpectType AbcObject[] _("").filter(stringIterator); // $ExpectType LoDashImplicitWrapper _(list).filter(listIterator); // $ExpectType LoDashImplicitWrapper _(list).filter(""); // $ExpectType LoDashImplicitWrapper _(list).filter({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(list).filter(["a", 42]); // $ExpectType LoDashImplicitWrapper _(dictionary).filter(dictionaryIterator); // $ExpectType LoDashImplicitWrapper _(dictionary).filter(""); // $ExpectType LoDashImplicitWrapper _(dictionary).filter({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(dictionary).filter(["a", 42]); // $ExpectType LoDashImplicitWrapper _.chain("").filter(stringIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).filter(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).filter(""); // $ExpectType LoDashExplicitWrapper _.chain(list).filter({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(list).filter(["a", 42]); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).filter(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).filter(""); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).filter({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).filter(["a", 42]); // $ExpectType LoDashExplicitWrapper fp.filter(valueIterator, list); // $ExpectType AbcObject[] fp.filter(valueIterator)(list); // $ExpectType AbcObject[] fp.filter("", list); // $ExpectType AbcObject[] fp.filter({ a: 42 }, list); // $ExpectType AbcObject[] fp.filter(["a", 42], list); // $ExpectType AbcObject[] fp.filter(valueIterator, dictionary); // $ExpectType AbcObject[] fp.filter("", dictionary); // $ExpectType AbcObject[] fp.filter({ a: 42 }, dictionary); // $ExpectType AbcObject[] fp.filter(["a", 42], dictionary); // $ExpectType AbcObject[] fp.filter((s: string) => s === "a")(["a", "b"]); // $ExpectType string[] fp.filter((s: string) => s === "a")("ab"); // $ExpectType string[] // Test filtering with type guard const a2: Array | null | undefined = anything; const d2: _.Dictionary | null | undefined = anything; _.filter(a2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] _.filter(d2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] _(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper _(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper _.chain(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper _.chain(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper fp.filter((item: string | number): item is number => typeof item === "number", a2); // $ExpectType number[] fp.filter((item: string | number): item is number => typeof item === "number", d2); // $ExpectType number[] } // _.find // _.findLast { _.find(list); // $ExpectType AbcObject | undefined _.find(list, listIterator); // $ExpectType AbcObject | undefined _.find(list, listIterator, 1); // $ExpectType AbcObject | undefined _.find(list, "a"); // $ExpectType AbcObject | undefined _.find(list, "a", 1); // $ExpectType AbcObject | undefined _.find(list, { a: 42 }); // $ExpectType AbcObject | undefined _.find(list, { a: 42 }, 1); // $ExpectType AbcObject | undefined _.find(list, ["a", 5]); // $ExpectType AbcObject | undefined _.find(list, ["a", 5], 1); // $ExpectType AbcObject | undefined _.find(dictionary); // $ExpectType AbcObject | undefined _.find(dictionary, dictionaryIterator); // $ExpectType AbcObject | undefined _.find(dictionary, dictionaryIterator, 1); // $ExpectType AbcObject | undefined _.find(dictionary, "a"); // $ExpectType AbcObject | undefined _.find(dictionary, { a: 42 }); // $ExpectType AbcObject | undefined _.find(dictionary, ["a", 5]); // $ExpectType AbcObject | undefined _.find([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined _(list).find(); // $ExpectType AbcObject | undefined _(list).find(listIterator); // $ExpectType AbcObject | undefined _(list).find(listIterator, 1); // $ExpectType AbcObject | undefined _(list).find("a"); // $ExpectType AbcObject | undefined _(list).find({ a: 42 }); // $ExpectType AbcObject | undefined _(list).find(["a", 5]); // $ExpectType AbcObject | undefined _(dictionary).find(); // $ExpectType AbcObject | undefined _(dictionary).find(dictionaryIterator); // $ExpectType AbcObject | undefined _(dictionary).find(dictionaryIterator, 1); // $ExpectType AbcObject | undefined _(dictionary).find("a"); // $ExpectType AbcObject | undefined _(dictionary).find({ a: 42 }); // $ExpectType AbcObject | undefined _(dictionary).find(["a", 5]); // $ExpectType AbcObject | undefined _([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined _.chain(list).find(); // $ExpectType LoDashExplicitWrapper _.chain(list).find(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).find(listIterator, 1); // $ExpectType LoDashExplicitWrapper _.chain(list).find("a"); // $ExpectType LoDashExplicitWrapper _.chain(list).find({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(list).find(["a", 5]); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).find(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).find(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).find(dictionaryIterator, 1); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).find(""); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).find({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).find(["a", 5]); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); fp.find(valueIterator, list); // $ExpectType AbcObject | undefined fp.find(valueIterator)(list); // $ExpectType AbcObject | undefined fp.find("a", list); // $ExpectType AbcObject | undefined fp.find({ a: 42 }, list); // $ExpectType AbcObject | undefined fp.find(["a", 42], list); // $ExpectType AbcObject | undefined fp.find(valueIterator, dictionary); // $ExpectType AbcObject | undefined fp.find(valueIterator)(dictionary); // $ExpectType AbcObject | undefined fp.find({ a: 42 }, dictionary); // $ExpectType AbcObject | undefined fp.find(["a", 42], dictionary); // $ExpectType AbcObject | undefined fp.find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null, [anything as AbcObject, null, undefined]); // $ExpectType AbcObject | undefined fp.findFrom(valueIterator, 1, list); // $ExpectType AbcObject | undefined fp.findFrom(valueIterator)(1)(list); // $ExpectType AbcObject | undefined _.findLast(list); // $ExpectType AbcObject | undefined _.findLast(list, listIterator); // $ExpectType AbcObject | undefined _.findLast(list, listIterator, 1); // $ExpectType AbcObject | undefined _.findLast(list, "a"); // $ExpectType AbcObject | undefined _.findLast(list, "a", 1); // $ExpectType AbcObject | undefined _.findLast(list, { a: 42 }); // $ExpectType AbcObject | undefined _.findLast(list, { a: 42 }, 1); // $ExpectType AbcObject | undefined _.findLast(list, ["a", 5]); // $ExpectType AbcObject | undefined _.findLast(list, ["a", 5], 1); // $ExpectType AbcObject | undefined _.findLast(dictionary); // $ExpectType AbcObject | undefined _.findLast(dictionary, dictionaryIterator); // $ExpectType AbcObject | undefined _.findLast(dictionary, dictionaryIterator, 1); // $ExpectType AbcObject | undefined _.findLast(dictionary, "a"); // $ExpectType AbcObject | undefined _.findLast(dictionary, { a: 42 }); // $ExpectType AbcObject | undefined _.findLast(dictionary, ["a", 5]); // $ExpectType AbcObject | undefined _.findLast([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined _(list).findLast(); // $ExpectType AbcObject | undefined _(list).findLast(listIterator); // $ExpectType AbcObject | undefined _(list).findLast(listIterator, 1); // $ExpectType AbcObject | undefined _(list).findLast("a"); // $ExpectType AbcObject | undefined _(list).findLast({ a: 42 }); // $ExpectType AbcObject | undefined _(list).findLast(["a", 5]); // $ExpectType AbcObject | undefined _(dictionary).findLast(); // $ExpectType AbcObject | undefined _(dictionary).findLast(dictionaryIterator); // $ExpectType AbcObject | undefined _(dictionary).findLast(dictionaryIterator, 1); // $ExpectType AbcObject | undefined _(dictionary).findLast("a"); // $ExpectType AbcObject | undefined _(dictionary).findLast({ a: 42 }); // $ExpectType AbcObject | undefined _(dictionary).findLast(["a", 5]); // $ExpectType AbcObject | undefined _([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined _.chain(list).findLast(); // $ExpectType LoDashExplicitWrapper _.chain(list).findLast(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findLast(listIterator, 1); // $ExpectType LoDashExplicitWrapper _.chain(list).findLast("a"); // $ExpectType LoDashExplicitWrapper _.chain(list).findLast({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(list).findLast(["a", 5]); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).findLast(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).findLast(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).findLast(dictionaryIterator, 1); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).findLast(""); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).findLast({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).findLast(["a", 5]); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); fp.findLast(valueIterator, list); // $ExpectType AbcObject | undefined fp.findLast(valueIterator)(list); // $ExpectType AbcObject | undefined fp.findLast("a", list); // $ExpectType AbcObject | undefined fp.findLast({ a: 42 }, list); // $ExpectType AbcObject | undefined fp.findLast(["a", 42], list); // $ExpectType AbcObject | undefined fp.findLast(valueIterator, dictionary); // $ExpectType AbcObject | undefined fp.findLast(valueIterator)(dictionary); // $ExpectType AbcObject | undefined fp.findLast({ a: 42 }, dictionary); // $ExpectType AbcObject | undefined fp.findLast(["a", 42], dictionary); // $ExpectType AbcObject | undefined fp.findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null, [anything as AbcObject, null, undefined]); // $ExpectType AbcObject | undefined fp.findLastFrom(valueIterator, 1, list); // $ExpectType AbcObject | undefined fp.findLastFrom(valueIterator)(1)(list); // $ExpectType AbcObject | undefined } // _.flatMap { const numList: _.List | null | undefined = anything; const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; const numDictionary: _.Dictionary | null | undefined = anything; const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; const numNumericDictionary: _.NumericDictionary | null | undefined = anything; const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; const stringIterator = (value: string, index: number, collection: _.List): string | string[] => ""; const listIterator = (value: number | number[], index: number, collection: _.List): number | number[] => 1; const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): number | number[] => 1; const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): number | number[] => 1; const valueIterator = (value: number | number[]): number | number[] => 1; _.flatMap("abc"); // $ExpectType string[] _.flatMap("abc", stringIterator); // $ExpectType string[] _.flatMap(numList); // $ExpectType number[] _.flatMap(numList, listIterator); // $ExpectType number[] _.flatMap(objList, "a"); // $ExpectType any[] _.flatMap(objList, ["a", 42]); // $ExpectType boolean[] _.flatMap(objList, { a: 42 }); // $ExpectType boolean[] _.flatMap(numDictionary); // $ExpectType number[] _.flatMap(numDictionary, dictionaryIterator); // $ExpectType number[] _.flatMap(objDictionary, "a"); // $ExpectType any[] _.flatMap(objDictionary, ["a", 42]); // $ExpectType boolean[] _.flatMap(objDictionary, { a: 42 }); // $ExpectType boolean[] _.flatMap(numNumericDictionary); // $ExpectType number[] _.flatMap(numNumericDictionary, numericDictionaryIterator); // $ExpectType number[] _.flatMap(objNumericDictionary, "a"); // $ExpectType any[] _.flatMap(objNumericDictionary, ["a", 42]); // $ExpectType boolean[] _.flatMap(objNumericDictionary, { a: 42 }); // $ExpectType boolean[] _("abc").flatMap(stringIterator); // $ExpectType LoDashImplicitWrapper _(numList).flatMap(); // $ExpectType LoDashImplicitWrapper _(numList).flatMap(listIterator); // $ExpectType LoDashImplicitWrapper _(objList).flatMap("a"); // $ExpectType LoDashImplicitWrapper _(objList).flatMap(["a", 42]); // $ExpectType LoDashImplicitWrapper _(objList).flatMap({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(numDictionary).flatMap(dictionaryIterator); // $ExpectType LoDashImplicitWrapper _(objDictionary).flatMap("a"); // $ExpectType LoDashImplicitWrapper _(numNumericDictionary).flatMap(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper _(objNumericDictionary).flatMap("a"); // $ExpectType LoDashImplicitWrapper _.chain("abc").flatMap(stringIterator); // $ExpectType LoDashExplicitWrapper _.chain(numList).flatMap(); // $ExpectType LoDashExplicitWrapper _.chain(numList).flatMap(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMap("a"); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMap(["a", 42]); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMap({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(numDictionary).flatMap(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(objDictionary).flatMap("a"); // $ExpectType LoDashExplicitWrapper _.chain(numNumericDictionary).flatMap(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(objNumericDictionary).flatMap("a"); // $ExpectType LoDashExplicitWrapper fp.flatMap(valueIterator, numList); // $ExpectType number[] fp.flatMap(valueIterator)(numList); // $ExpectType number[] fp.flatMap("a", objList); // $ExpectType any[] fp.flatMap({ a: 42 }, objList); // $ExpectType boolean[] fp.flatMap(["a", 42], objList); // $ExpectType boolean[] fp.flatMap(valueIterator, numDictionary); // $ExpectType number[] fp.flatMap("a", objDictionary); // $ExpectType any[] fp.flatMap({ a: 42 }, objDictionary); // $ExpectType boolean[] fp.flatMap(["a", 42], objDictionary); // $ExpectType boolean[] fp.flatMap(valueIterator, numNumericDictionary); // $ExpectType number[] fp.flatMap("a", objNumericDictionary); // $ExpectType any[] fp.flatMap({ a: 42 }, objNumericDictionary); // $ExpectType boolean[] fp.flatMap(["a", 42], objNumericDictionary); // $ExpectType boolean[] } // _.flatMapDeep, _.flatMapDepth { const numList: _.List | null | undefined = anything; const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; const numDictionary: _.Dictionary | null | undefined = anything; const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; const numNumericDictionary: _.NumericDictionary | null | undefined = anything; const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; _.flatMapDeep("abc"); // $ExpectType string[] _.flatMapDeep("abc", stringIterator); // $ExpectType string[] _.flatMapDeep(numList); // $ExpectType number[] _.flatMapDeep(numList, listIterator); // $ExpectType number[] _.flatMapDeep(objList, "a"); // $ExpectType any[] _.flatMapDeep(objList, ["a", 42]); // $ExpectType boolean[] _.flatMapDeep(objList, { a: 42 }); // $ExpectType boolean[] _.flatMapDeep(numDictionary); // $ExpectType number[] _.flatMapDeep(numDictionary, dictionaryIterator); // $ExpectType number[] _.flatMapDeep(objDictionary, "a"); // $ExpectType any[] _.flatMapDeep(objDictionary, ["a", 42]); // $ExpectType boolean[] _.flatMapDeep(objDictionary, { a: 42 }); // $ExpectType boolean[] _.flatMapDeep(numNumericDictionary); // $ExpectType number[] _.flatMapDeep(numNumericDictionary, numericDictionaryIterator); // $ExpectType number[] _.flatMapDeep(objNumericDictionary, "a"); // $ExpectType any[] _.flatMapDeep(objNumericDictionary, ["a", 42]); // $ExpectType boolean[] _.flatMapDeep(objNumericDictionary, { a: 42 }); // $ExpectType boolean[] _("abc").flatMapDeep(stringIterator); // $ExpectType LoDashImplicitWrapper _(numList).flatMapDeep(); // $ExpectType LoDashImplicitWrapper _(numList).flatMapDeep(listIterator); // $ExpectType LoDashImplicitWrapper _(objList).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper _(objList).flatMapDeep(["a", 42]); // $ExpectType LoDashImplicitWrapper _(objList).flatMapDeep({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(numDictionary).flatMapDeep(dictionaryIterator); // $ExpectType LoDashImplicitWrapper _(objDictionary).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper _(numNumericDictionary).flatMapDeep(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper _(objNumericDictionary).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper _.chain("abc").flatMapDeep(stringIterator); // $ExpectType LoDashExplicitWrapper _.chain(numList).flatMapDeep(); // $ExpectType LoDashExplicitWrapper _.chain(numList).flatMapDeep(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMapDeep(["a", 42]); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMapDeep({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(numDictionary).flatMapDeep(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(objDictionary).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper _.chain(numNumericDictionary).flatMapDeep(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(objNumericDictionary).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper fp.flatMapDeep(valueIterator, numList); // $ExpectType number[] fp.flatMapDeep(valueIterator)(numList); // $ExpectType number[] fp.flatMapDeep("a", objList); // $ExpectType any[] fp.flatMapDeep({ a: 42 }, objList); // $ExpectType boolean[] fp.flatMapDeep(["a", 42], objList); // $ExpectType boolean[] fp.flatMapDeep(valueIterator, numDictionary); // $ExpectType number[] fp.flatMapDeep("a", objDictionary); // $ExpectType any[] fp.flatMapDeep({ a: 42 }, objDictionary); // $ExpectType boolean[] fp.flatMapDeep(["a", 42], objDictionary); // $ExpectType boolean[] fp.flatMapDeep(valueIterator, numNumericDictionary); // $ExpectType number[] fp.flatMapDeep("a", objNumericDictionary); // $ExpectType any[] fp.flatMapDeep({ a: 42 }, objNumericDictionary); // $ExpectType boolean[] fp.flatMapDeep(["a", 42], objNumericDictionary); // $ExpectType boolean[] _.flatMapDepth("abc"); // $ExpectType string[] _.flatMapDepth("abc", stringIterator); // $ExpectType string[] _.flatMapDepth("abc", stringIterator, 3); // $ExpectType string[] _.flatMapDepth(numList, listIterator, 3); // $ExpectType number[] _.flatMapDepth(objList, "a", 3); // $ExpectType any[] _.flatMapDepth(objList, ["a", 42], 3); // $ExpectType boolean[] _.flatMapDepth(objList, { a: 42 }, 3); // $ExpectType boolean[] _.flatMapDepth(numDictionary, dictionaryIterator, 3); // $ExpectType number[] _.flatMapDepth(objDictionary, "a", 3); // $ExpectType any[] _.flatMapDepth(objDictionary, ["a", 42], 3); // $ExpectType boolean[] _.flatMapDepth(objDictionary, { a: 42 }, 3); // $ExpectType boolean[] _.flatMapDepth(numNumericDictionary, numericDictionaryIterator, 3); // $ExpectType number[] _.flatMapDepth(objNumericDictionary, "a", 3); // $ExpectType any[] _.flatMapDepth(objNumericDictionary, ["a", 42], 3); // $ExpectType boolean[] _.flatMapDepth(objNumericDictionary, { a: 42 }, 3); // $ExpectType boolean[] _("abc").flatMapDepth(stringIterator, 3); // $ExpectType LoDashImplicitWrapper _(numList).flatMapDepth(listIterator, 3); // $ExpectType LoDashImplicitWrapper _(objList).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper _(objList).flatMapDepth(["a", 42], 3); // $ExpectType LoDashImplicitWrapper _(objList).flatMapDepth({ a: 42 }, 3); // $ExpectType LoDashImplicitWrapper _(numDictionary).flatMapDepth(dictionaryIterator, 3); // $ExpectType LoDashImplicitWrapper _(objDictionary).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper _(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 3); // $ExpectType LoDashImplicitWrapper _(objNumericDictionary).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper _.chain("abc").flatMapDepth(stringIterator, 3); // $ExpectType LoDashExplicitWrapper _.chain(numList).flatMapDepth(listIterator, 3); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMapDepth(["a", 42], 3); // $ExpectType LoDashExplicitWrapper _.chain(objList).flatMapDepth({ a: 42 }, 3); // $ExpectType LoDashExplicitWrapper _.chain(numDictionary).flatMapDepth(dictionaryIterator, 3); // $ExpectType LoDashExplicitWrapper _.chain(objDictionary).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper _.chain(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 3); // $ExpectType LoDashExplicitWrapper _.chain(objNumericDictionary).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper fp.flatMapDepth(valueIterator, 3, numList); // $ExpectType number[] fp.flatMapDepth(valueIterator)(3)(numList); // $ExpectType number[] fp.flatMapDepth("a", 3, objList); // $ExpectType any[] fp.flatMapDepth({ a: 42 }, 3, objList); // $ExpectType boolean[] fp.flatMapDepth(["a", 42], 3, objList); // $ExpectType boolean[] fp.flatMapDepth(valueIterator, 3, numDictionary); // $ExpectType number[] fp.flatMapDepth("a", 3, objDictionary); // $ExpectType any[] fp.flatMapDepth({ a: 42 }, 3, objDictionary); // $ExpectType boolean[] fp.flatMapDepth(["a", 42], 3, objDictionary); // $ExpectType boolean[] fp.flatMapDepth(valueIterator, 3, numNumericDictionary); // $ExpectType number[] fp.flatMapDepth("a", 3, objNumericDictionary); // $ExpectType any[] fp.flatMapDepth({ a: 42 }, 3, objNumericDictionary); // $ExpectType boolean[] fp.flatMapDepth(["a", 42], 3, objNumericDictionary); // $ExpectType boolean[] } // _.forEach // _.forEachRight // _.each // _.eachRight { const str: string = anything; const nilStr: string | null | undefined = anything; const array: AbcObject[] = anything; const list: _.List = anything; const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; const nilArray: AbcObject[] | null | undefined = anything; const nilList: _.List | null | undefined = anything; const nilDictionary: _.Dictionary | null | undefined = anything; const nilNumericDictionary: _.NumericDictionary | null | undefined = anything; const nilAbcObject: AbcObject | null | undefined = anything; // $ExpectType string _.forEach(str, (value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType string | null | undefined _.forEach(nilStr, (value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType AbcObject[] _.forEach(array, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType AbcObject[] | null | undefined _.forEach(nilArray, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType ArrayLike _.forEach(list, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType ArrayLike | null | undefined _.forEach(nilList, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType Dictionary _.forEach(dictionary, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType Dictionary | null | undefined _.forEach(nilDictionary, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType NumericDictionary _.forEach(numericDictionary, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); // $ExpectType NumericDictionary | null | undefined _.forEach(nilNumericDictionary, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); // $ExpectType AbcObject _.forEach(abcObject, (value, index, collection) => { value; // $ExpectType string | number | boolean index; // $ExpectType string collection; // $ExpectType AbcObject }); // $ExpectType AbcObject | null | undefined _.forEach(nilAbcObject, (value, index, collection) => { value; // $ExpectType string | number | boolean index; // $ExpectType string collection; // $ExpectType AbcObject }); // $ExpectType LoDashImplicitWrapper _(str).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashImplicitWrapper _(nilStr).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashImplicitWrapper _(array).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashImplicitWrapper _(nilArray).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashImplicitWrapper> _(list).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashImplicitWrapper | null | undefined> _(nilList).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashImplicitWrapper> _(dictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashImplicitWrapper | null | undefined> _(nilDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); // $ExpectType LoDashImplicitWrapper | null | undefined> _(nilNumericDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); // $ExpectType LoDashExplicitWrapper _.chain(str).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashExplicitWrapper _.chain(nilStr).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashExplicitWrapper _.chain(array).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper _.chain(nilArray).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper> _.chain(list).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper | null | undefined> _.chain(nilList).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashExplicitWrapper | null | undefined> _.chain(nilDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); // $ExpectType LoDashExplicitWrapper | null | undefined> _.chain(nilNumericDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); fp.forEach(stringIterator, ""); // $ExpectType ArrayLike fp.forEach(valueIterator, array); // $ExpectType AbcObject[] fp.forEach(valueIterator)(array); // $ExpectType AbcObject[] fp.forEach(valueIterator, list); // $ExpectType ArrayLike fp.forEach(valueIterator, dictionary); // $ExpectType Dictionary fp.forEach(valueIterator, nilArray); // $ExpectType AbcObject[] | null | undefined fp.forEach(valueIterator, nilList); // $ExpectType ArrayLike | null | undefined fp.forEach(valueIterator, nilDictionary); // $ExpectType Dictionary | null | undefined // $ExpectType AbcObject[] _.forEachRight(array, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType ArrayLike | null | undefined _.forEachRight(nilList, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashImplicitWrapper _(array).forEachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashImplicitWrapper | null | undefined> _(nilList).forEachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper _.chain(array).forEachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper | null | undefined> _.chain(nilList).forEachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); fp.forEachRight(valueIterator, array); // $ExpectType AbcObject[] fp.forEachRight(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.each(array, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType ArrayLike | null | undefined _.each(nilList, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashImplicitWrapper _(array).each((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashImplicitWrapper | null | undefined> _(nilList).each((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper _.chain(array).each((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper | null | undefined> _.chain(nilList).each((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); fp.each(valueIterator, array); // $ExpectType AbcObject[] fp.each(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.eachRight(array, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType ArrayLike | null | undefined _.eachRight(nilList, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashImplicitWrapper _(array).eachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashImplicitWrapper | null | undefined> _(nilList).eachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper _.chain(array).eachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper | null | undefined> _.chain(nilList).eachRight((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); fp.eachRight(valueIterator, array); // $ExpectType AbcObject[] fp.eachRight(valueIterator)(array); // $ExpectType AbcObject[] } // _.groupBy { _.groupBy(""); // $ExpectType Dictionary _.groupBy("", stringIterator); // $ExpectType Dictionary _.groupBy(list); // $ExpectType Dictionary _.groupBy(list, valueIterator); // $ExpectType Dictionary _.groupBy(list, "a"); // $ExpectType Dictionary _.groupBy(list, { a: 42 }); // $ExpectType Dictionary _.groupBy(dictionary); // $ExpectType Dictionary _.groupBy(dictionary, valueIterator); // $ExpectType Dictionary _.groupBy(dictionary, ""); // $ExpectType Dictionary _.groupBy(dictionary, { a: 42 }); // $ExpectType Dictionary _("").groupBy(); // $ExpectType LoDashImplicitWrapper> _("").groupBy(stringIterator); // $ExpectType LoDashImplicitWrapper> _(list).groupBy(); // $ExpectType LoDashImplicitWrapper> _(list).groupBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(list).groupBy(""); // $ExpectType LoDashImplicitWrapper> _(list).groupBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _(dictionary).groupBy(); // $ExpectType LoDashImplicitWrapper> _(dictionary).groupBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(dictionary).groupBy(""); // $ExpectType LoDashImplicitWrapper> _(dictionary).groupBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _.chain("").groupBy(); // $ExpectType LoDashExplicitWrapper> _.chain("").groupBy(stringIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).groupBy(); // $ExpectType LoDashExplicitWrapper> _.chain(list).groupBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).groupBy(""); // $ExpectType LoDashExplicitWrapper> _.chain(list).groupBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).groupBy(); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).groupBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).groupBy(""); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).groupBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> fp.groupBy(valueIterator, list); // $ExpectType Dictionary fp.groupBy(valueIterator)(list); // $ExpectType Dictionary fp.groupBy("a", list); // $ExpectType Dictionary fp.groupBy({ a: 42 }, list); // $ExpectType Dictionary fp.groupBy(["a", 42], list); // $ExpectType Dictionary fp.groupBy(valueIterator, dictionary); // $ExpectType Dictionary fp.groupBy("a", dictionary); // $ExpectType Dictionary fp.groupBy({ a: 42 }, dictionary); // $ExpectType Dictionary fp.groupBy(["a", 42], dictionary); // $ExpectType Dictionary } // _.includes { _.includes(list, abcObject); // $ExpectType boolean _.includes(list, abcObject, 42); // $ExpectType boolean _.includes(dictionary, abcObject); // $ExpectType boolean _.includes(dictionary, abcObject, 42); // $ExpectType boolean _(list).includes(abcObject); // $ExpectType boolean _(list).includes(abcObject, 42); // $ExpectType boolean _(dictionary).includes(abcObject); // $ExpectType boolean _(dictionary).includes(abcObject, 42); // $ExpectType boolean _.chain(list).includes(abcObject); // $ExpectType LoDashExplicitWrapper _.chain(list).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).includes(abcObject); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper fp.includes(abcObject, list); // $ExpectType boolean fp.includes(abcObject)(list); // $ExpectType boolean fp.includes(abcObject, dictionary); // $ExpectType boolean fp.includesFrom(abcObject, 42, list); // $ExpectType boolean fp.includesFrom(abcObject)(42)(list); // $ExpectType boolean fp.includesFrom(abcObject, 42, dictionary); // $ExpectType boolean } // _.keyBy { const valueIterator = (value: AbcObject) => ""; const subKey: string | number | symbol = anything; _.keyBy("abcd"); // $ExpectType Dictionary _.keyBy("abcd", stringIterator); // $ExpectType Dictionary _.keyBy(list); // $ExpectType Dictionary _.keyBy(list, valueIterator); // $ExpectType Dictionary _.keyBy(list, subKey); // $ExpectType Dictionary _.keyBy(list, { a: 42 }); // $ExpectType Dictionary _.keyBy(dictionary); // $ExpectType Dictionary _.keyBy(dictionary, valueIterator); // $ExpectType Dictionary _.keyBy(dictionary, subKey); // $ExpectType Dictionary _.keyBy(dictionary, { a: 42 }); // $ExpectType Dictionary _.keyBy(numericDictionary); // $ExpectType Dictionary _.keyBy(numericDictionary, valueIterator); // $ExpectType Dictionary _.keyBy(numericDictionary, "a"); // $ExpectType Dictionary _.keyBy(numericDictionary, subKey); // $ExpectType Dictionary _.keyBy(numericDictionary, { a: 42 }); // $ExpectType Dictionary _("abcd").keyBy(); // $ExpectType LoDashImplicitWrapper> _("abcd").keyBy(stringIterator); // $ExpectType LoDashImplicitWrapper> _(list).keyBy(); // $ExpectType LoDashImplicitWrapper> _(list).keyBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(list).keyBy(subKey); // $ExpectType LoDashImplicitWrapper> _(list).keyBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _(dictionary).keyBy(); // $ExpectType LoDashImplicitWrapper> _(dictionary).keyBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(dictionary).keyBy(subKey); // $ExpectType LoDashImplicitWrapper> _(dictionary).keyBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).keyBy(); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).keyBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).keyBy(subKey); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).keyBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> _.chain("abcd").keyBy(); // $ExpectType LoDashExplicitWrapper> _.chain("abcd").keyBy(stringIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).keyBy(); // $ExpectType LoDashExplicitWrapper> _.chain(list).keyBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).keyBy(subKey); // $ExpectType LoDashExplicitWrapper> _.chain(list).keyBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).keyBy(); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).keyBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).keyBy(subKey); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).keyBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).keyBy(); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).keyBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).keyBy(subKey); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).keyBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> fp.keyBy(valueIterator, list); // $ExpectType Dictionary fp.keyBy(valueIterator)(list); // $ExpectType Dictionary fp.keyBy(subKey, list); // $ExpectType Dictionary fp.keyBy({ a: 42 }, list); // $ExpectType Dictionary fp.keyBy([subKey, 42], list); // $ExpectType Dictionary fp.keyBy(valueIterator, dictionary); // $ExpectType Dictionary fp.keyBy(subKey, dictionary); // $ExpectType Dictionary fp.keyBy({ a: 42 }, dictionary); // $ExpectType Dictionary fp.keyBy([subKey, 42], dictionary); // $ExpectType Dictionary fp.keyBy(valueIterator, numericDictionary); // $ExpectType Dictionary fp.keyBy(subKey, numericDictionary); // $ExpectType Dictionary fp.keyBy({ a: 42 }, numericDictionary); // $ExpectType Dictionary fp.keyBy([subKey, 42], numericDictionary); // $ExpectType Dictionary } // _.invoke { const array = [(n?: number) => {}]; const nestedDict = { a: [(n?: number) => {}] }; _.invoke(array, "[0]"); // $ExpectType any _.invoke(array, "[0]", 2); // $ExpectType any _.invoke(array, [0, "call"]); // $ExpectType any _.invoke(array, [0, "call"], 2); // $ExpectType any _.invoke(nestedDict, ["a[0].toString"]); // $ExpectType any _.invoke(nestedDict, ["a[0].toString"], 2); // $ExpectType any _.invoke(nestedDict, ["a", 0, "toString"]); // $ExpectType any _.invoke(nestedDict, ["a", 0, "toString"], 2); // $ExpectType any _(array).invoke("[0]"); // $ExpectType any _(array).invoke("[0]", 2); // $ExpectType any _(array).invoke([0, "call"]); // $ExpectType any _(array).invoke([0, "call"], 2); // $ExpectType any _(nestedDict).invoke(["a[0].toString"]); // $ExpectType any _(nestedDict).invoke(["a[0].toString"], 2); // $ExpectType any _(nestedDict).invoke(["a", 0, "toString"]); // $ExpectType any _(nestedDict).invoke(["a", 0, "toString"], 2); // $ExpectType any _.chain(array).invoke("[0]"); // $ExpectType LoDashExplicitWrapper _.chain(array).invoke("[0]", 2); // $ExpectType LoDashExplicitWrapper _.chain(array).invoke([0, "call"]); // $ExpectType LoDashExplicitWrapper _.chain(array).invoke([0, "call"], 2); // $ExpectType LoDashExplicitWrapper _.chain(nestedDict).invoke(["a[0].toString"]); // $ExpectType LoDashExplicitWrapper _.chain(nestedDict).invoke(["a[0].toString"], 2); // $ExpectType LoDashExplicitWrapper _.chain(nestedDict).invoke(["a", 0, "toString"]); // $ExpectType LoDashExplicitWrapper _.chain(nestedDict).invoke(["a", 0, "toString"], 2); // $ExpectType LoDashExplicitWrapper fp.invoke("[0]", array); // $ExpectType any fp.invoke("[0]")(array); // $ExpectType any fp.invoke(["[0]", 2], array); // $ExpectType any fp.invoke("a[0].toString", nestedDict); // $ExpectType any fp.invoke(["a", 0, "toString"], nestedDict); // $ExpectType any } // _.invokeMap { const numArray: number[] | null | undefined = anything; const numDict: _.Dictionary | null | undefined = anything; _.invokeMap(numArray, "toString"); // $ExpectType any[] _.invokeMap(numArray, "toString", 2); // $ExpectType any[] _.invokeMap(numArray, Number.prototype.toString); // $ExpectType string[] _.invokeMap(numDict, "toString"); // $ExpectType any[] _(numArray).invokeMap("toString"); // $ExpectType LoDashImplicitWrapper _(numArray).invokeMap("toString", 2); // $ExpectType LoDashImplicitWrapper _(numArray).invokeMap(Number.prototype.toString); // $ExpectType LoDashImplicitWrapper _(numDict).invokeMap("toString"); // $ExpectType LoDashImplicitWrapper _.chain(numArray).invokeMap("toString"); // $ExpectType LoDashExplicitWrapper _.chain(numArray).invokeMap("toString", 2); // $ExpectType LoDashExplicitWrapper _.chain(numArray).invokeMap(Number.prototype.toString); // $ExpectType LoDashExplicitWrapper _.chain(numDict).invokeMap("toString"); // $ExpectType LoDashExplicitWrapper fp.invokeMap("toString", numArray); // $ExpectType any[] fp.invokeMap("toString")(numArray); // $ExpectType any[] fp.invokeMap(Number.prototype.toString, numArray); // $ExpectType string[] fp.invokeMap("toString", numDict); // $ExpectType any[] fp.invokeMap(Number.prototype.toString, numDict); // $ExpectType string[] fp.invokeArgsMap("toString", [16], numArray); // $ExpectType any[] fp.invokeArgsMap("toString")([16])(numArray); // $ExpectType any[] fp.invokeArgsMap(Number.prototype.toString, [16], numArray); // $ExpectType string[] fp.invokeArgsMap("toString", [16], numDict); // $ExpectType any[] fp.invokeArgsMap(Number.prototype.toString, [16], numDict); // $ExpectType string[] } // _.map { _.map(list); // $ExpectType AbcObject[] // $ExpectType number[] _.map(list, (value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike return 0; }); _.map(dictionary); // $ExpectType AbcObject[] // $ExpectType number[] _.map(dictionary, (value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return 0; }); _.map(numericDictionary); // $ExpectType AbcObject[] // $ExpectType number[] _.map(numericDictionary, (value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType NumericDictionary return 0; }); _.map(list, "a"); // $ExpectType number[] _.map(dictionary, "a"); // $ExpectType number[] _.map(numericDictionary, "a"); // $ExpectType number[] _.map(list, "d.0.b"); // $ExpectType any[] _.map(dictionary, "d.0.b"); // $ExpectType any[] _.map(numericDictionary, "d.0.b"); // $ExpectType any[] _.map(list, { a: 42 }); // $ExpectType boolean[] _.map(dictionary, { a: 42 }); // $ExpectType boolean[] _.map(numericDictionary, { a: 42 }); // $ExpectType boolean[] _(list).map(); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(list).map((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike return 0; }); _(dictionary).map(); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(dictionary).map((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return 0; }); _(numericDictionary).map(); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(numericDictionary).map((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType NumericDictionary return 0; }); _(list).map("a"); // $ExpectType LoDashImplicitWrapper _(dictionary).map("a"); // $ExpectType LoDashImplicitWrapper _(numericDictionary).map("a"); // $ExpectType LoDashImplicitWrapper _(list).map("d.0.b"); // $ExpectType LoDashImplicitWrapper _(dictionary).map("d.0.b"); // $ExpectType LoDashImplicitWrapper _(numericDictionary).map("d.0.b"); // $ExpectType LoDashImplicitWrapper _(list).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(dictionary).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(numericDictionary).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).map(); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(list).map((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike return 0; }); _.chain(dictionary).map(); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(dictionary).map((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return 0; }); _.chain(numericDictionary).map(); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).map((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType NumericDictionary return 0; }); _.chain(list).map("a"); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).map("a"); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).map("a"); // $ExpectType LoDashExplicitWrapper _.chain(list).map("d.0.b"); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).map("d.0.b"); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).map("d.0.b"); // $ExpectType LoDashExplicitWrapper _.chain(list).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper const valueIterator = (value: AbcObject): number => value.a; fp.map(valueIterator)(list); // $ExpectType number[] fp.map(valueIterator, dictionary); // $ExpectType number[] fp.map("a", list); // $ExpectType number[] fp.map({ a: 42 }, list); // $ExpectType boolean[] fp.map(["a", 42], dictionary); // $ExpectType boolean[] } // _.partition { const mixedArray = [1, 2, '3', '4']; // $ExpectType [any[], any[]] _.partition(anything, (value) => { value; // $ExpectType any return value < "c"; }); // $ExpectType [string[], string[]] _.partition("abcd", (value) => { value; // $ExpectType string return value < "c"; }); // $ExpectType [AbcObject[], AbcObject[]] _.partition(list, (value) => { value; // $ExpectType AbcObject return true; }); // $ExpectType [number[], string[]] _.partition(mixedArray, (value): value is number => typeof value === 'number'); // $ExpectType LoDashImplicitWrapper<[any[], any[]]> _(anything).partition((value) => { value; // $ExpectType any return value < "c"; }); // $ExpectType LoDashImplicitWrapper<[string[], string[]]> _("abcd").partition((value) => { value; // $ExpectType string return value < "c"; }); // $ExpectType LoDashImplicitWrapper<[AbcObject[], AbcObject[]]> _(list).partition((value) => { value; // $ExpectType AbcObject return true; }); // $ExpectType LoDashImplicitWrapper<[number[], string[]]> _(mixedArray).partition((value): value is number => typeof value === 'number'); // $ExpectType LoDashExplicitWrapper<[any[], any[]]> _.chain(anything).partition((value) => { value; // $ExpectType any return value < "c"; }); // $ExpectType LoDashExplicitWrapper<[string[], string[]]> _.chain("abcd").partition((value) => { value; // $ExpectType string return value < "c"; }); // $ExpectType LoDashExplicitWrapper<[AbcObject[], AbcObject[]]> _.chain(list).partition((value) => { value; // $ExpectType AbcObject return true; }); // $ExpectType LoDashExplicitWrapper<[number[], string[]]> _.chain(mixedArray).partition((value): value is number => typeof value === 'number'); // $ExpectType [any[], any[]] fp.partition((value) => { value; // $ExpectType any return value < "c"; }, anything); // $ExpectType [any[], any[]] fp.partition((value: any) => value < "c")(anything); // $ExpectType [string[], string[]] fp.partition((value) => { value; // $ExpectType string return value < "c"; }, "abcd"); // $ExpectType [AbcObject[], AbcObject[]] fp.partition((value) => { value; // $ExpectType AbcObject return true; }, list); // $ExpectType [number[], string[]] fp.partition((value): value is number => typeof value === 'number', mixedArray); } // _.reduce { interface ABC { [key: string]: number; a: number; b: number; c: number; } const initial: ABC = { a: 1, b: 2, c: 3 }; // $ExpectType number | undefined _.reduce([1, 2, 3], (sum, curr, key, coll) => { sum; // $ExpectType number curr; // $ExpectType number key; // $ExpectType number coll; // $ExpectType number[] return sum + curr; }); _.reduce(null, (sum: number, num: number) => sum + num); // $ExpectType number | undefined _.reduce({ a: 1, b: 2, c: 3 }, (r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC _([1, 2, 3]).reduce((sum, num) => sum + num); // $ExpectType number | undefined _({ a: 1, b: 2, c: 3 }).reduce((r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC _.chain([1, 2, 3]).reduce((sum, num) => sum + num); // $ExpectType LoDashExplicitWrapper _.chain({ a: 1, b: 2, c: 3 }).reduce((r: ABC, num: number, key: string) => r, initial); // $ExpectType LoDashExplicitWrapper fp.reduce((s: string, num: number) => s + num, "", [1, 2, 3]); // $ExpectType string fp.reduce((s: string, num: number) => s + num)("")([1, 2, 3]); // $ExpectType string _.reduceRight([1, 2, 3], (sum, num) => sum + num); // $ExpectType number | undefined _.reduceRight(null, (sum: number, num: number) => sum + num); // $ExpectType number | undefined _.reduceRight({ a: 1, b: 2, c: 3 }, (r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC _([1, 2, 3]).reduceRight((sum, num) => sum + num); // $ExpectType number | undefined _({ a: 1, b: 2, c: 3 }).reduceRight((r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC _.chain([1, 2, 3]).reduceRight((sum, num) => sum + num); // $ExpectType LoDashExplicitWrapper _.chain({ a: 1, b: 2, c: 3 }).reduceRight((r: ABC, num: number, key: string) => r, initial); // $ExpectType LoDashExplicitWrapper fp.reduceRight((num: number, s: string) => s + num, "", [1, 2, 3]); // $ExpectType string fp.reduceRight((num: number, s: string) => s + num)("")([1, 2, 3]); // $ExpectType string } // _.reject { const stringIterator = (char: string, index: number, string: string) => true; _.reject("", stringIterator); // $ExpectType string[] _.reject(list, listIterator); // $ExpectType AbcObject[] _.reject(list, ""); // $ExpectType AbcObject[] _.reject(list, { a: 42 }); // $ExpectType AbcObject[] _.reject(dictionary, dictionaryIterator); // $ExpectType AbcObject[] _.reject(dictionary, ""); // $ExpectType AbcObject[] _.reject(dictionary, { a: 42 }); // $ExpectType AbcObject[] _("").reject(stringIterator); // $ExpectType LoDashImplicitWrapper _(list).reject(listIterator); // $ExpectType LoDashImplicitWrapper _(list).reject(""); // $ExpectType LoDashImplicitWrapper _(list).reject({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(dictionary).reject(dictionaryIterator); // $ExpectType LoDashImplicitWrapper _(dictionary).reject(""); // $ExpectType LoDashImplicitWrapper _(dictionary).reject({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain("").reject(stringIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).reject(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).reject(""); // $ExpectType LoDashExplicitWrapper _.chain(list).reject({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).reject(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).reject(""); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).reject({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.reject(valueIterator, list); // $ExpectType AbcObject[] fp.reject(valueIterator)(list); // $ExpectType AbcObject[] fp.reject(valueIterator, dictionary); // $ExpectType AbcObject[] fp.reject("a", list); // $ExpectType AbcObject[] fp.reject({ a: 42 }, list); // $ExpectType AbcObject[] fp.reject(["a", 42], list); // $ExpectType AbcObject[] } // _.sample // _.sampleSize { const list: _.List | null | undefined = anything; const dictionary: _.Dictionary | null | undefined = anything; const numericDictionary: _.NumericDictionary | null | undefined = anything; _.sample("abc"); // $ExpectType string | undefined _.sample(list); // $ExpectType string | undefined _.sample(dictionary); // $ExpectType string | undefined _.sample(numericDictionary); // $ExpectType string | undefined _.sample({ a: "foo" }); // $ExpectType string | undefined _("abc").sample(); // $ExpectType string | undefined _(list).sample(); // $ExpectType string | undefined _(dictionary).sample(); // $ExpectType string | undefined _(numericDictionary).sample(); // $ExpectType string | undefined _({ a: "foo" }).sample(); // $ExpectType string | undefined _.chain("abc").sample(); // $ExpectType LoDashExplicitWrapper _.chain(list).sample(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).sample(); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).sample(); // $ExpectType LoDashExplicitWrapper _.chain({ a: "foo" }).sample(); // $ExpectType LoDashExplicitWrapper fp.sample("abc"); // $ExpectType string | undefined fp.sample(list); // $ExpectType string | undefined fp.sample({ a: "foo" }); // $ExpectType string | undefined _.sampleSize("abc"); // $ExpectType string[] _.sampleSize("abc", 3); // $ExpectType string[] _.sampleSize(list, 3); // $ExpectType string[] _.sampleSize(dictionary, 3); // $ExpectType string[] _.sampleSize(numericDictionary, 3); // $ExpectType string[] _.sampleSize({ a: "foo" }, 3); // $ExpectType string[] _("abc").sampleSize(); // $ExpectType LoDashImplicitWrapper _("abc").sampleSize(3); // $ExpectType LoDashImplicitWrapper _(list).sampleSize(3); // $ExpectType LoDashImplicitWrapper _(dictionary).sampleSize(3); // $ExpectType LoDashImplicitWrapper _(numericDictionary).sampleSize(3); // $ExpectType LoDashImplicitWrapper _({ a: "foo" }).sampleSize(3); // $ExpectType LoDashImplicitWrapper _.chain("abc").sampleSize(); // $ExpectType LoDashExplicitWrapper _.chain("abc").sampleSize(3); // $ExpectType LoDashExplicitWrapper _.chain(list).sampleSize(3); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).sampleSize(3); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).sampleSize(3); // $ExpectType LoDashExplicitWrapper _.chain({ a: "foo" }).sampleSize(3); // $ExpectType LoDashExplicitWrapper fp.sampleSize(3, "abc"); // $ExpectType string[] fp.sampleSize(3)(list); // $ExpectType string[] fp.sampleSize(3)({ a: "foo" }); // $ExpectType string[] } // _.shuffle { _.shuffle("abc"); // $ExpectType string[] _.shuffle(list); // $ExpectType AbcObject[] _.shuffle(dictionary); // $ExpectType AbcObject[] _("abc").shuffle(); // $ExpectType LoDashImplicitWrapper _(list).shuffle(); // $ExpectType LoDashImplicitWrapper _(dictionary).shuffle(); // $ExpectType LoDashImplicitWrapper _.chain("abc").shuffle(); // $ExpectType LoDashExplicitWrapper _.chain(list).shuffle(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).shuffle(); // $ExpectType LoDashExplicitWrapper fp.shuffle("abc"); // $ExpectType string[] fp.shuffle(list); // $ExpectType AbcObject[] fp.shuffle(dictionary); // $ExpectType AbcObject[] } // _.size { _.size(list); // $ExpectType number _.size(dictionary); // $ExpectType number _.size(""); // $ExpectType number _(list).size(); // $ExpectType number _(dictionary).size(); // $ExpectType number _("").size(); // $ExpectType number _.chain(list).size(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).size(); // $ExpectType LoDashExplicitWrapper _.chain("").size(); // $ExpectType LoDashExplicitWrapper fp.size(list); // $ExpectType number fp.size(dictionary); // $ExpectType number fp.size(""); // $ExpectType number } // _.some { const subKey: string | number | symbol = anything; _.some(list); // $ExpectType boolean _.some(list, listIterator); // $ExpectType boolean _.some(list, subKey); // $ExpectType boolean _.some(list, [subKey, 42]); // $ExpectType boolean _.some(list, { a: 42 }); // $ExpectType boolean _.some(dictionary); // $ExpectType boolean _.some(dictionary, dictionaryIterator); // $ExpectType boolean _.some(dictionary, subKey); // $ExpectType boolean _.some(dictionary, [subKey, 42]); // $ExpectType boolean _.some(dictionary, { a: 42 }); // $ExpectType boolean _.some(numericDictionary); // $ExpectType boolean _.some(numericDictionary, numericDictionaryIterator); // $ExpectType boolean _.some(numericDictionary, subKey); // $ExpectType boolean _.some(numericDictionary, [subKey, 42]); // $ExpectType boolean _.some(numericDictionary, { a: 42 }); // $ExpectType boolean _(list).some(); // $ExpectType boolean _(list).some(listIterator); // $ExpectType boolean _(list).some(subKey); // $ExpectType boolean _(list).some([subKey, 42]); // $ExpectType boolean _(list).some({ a: 42 }); // $ExpectType boolean _(dictionary).some(); // $ExpectType boolean _(dictionary).some(dictionaryIterator); // $ExpectType boolean _(dictionary).some(subKey); // $ExpectType boolean _(dictionary).some([subKey, 42]); // $ExpectType boolean _(dictionary).some({ a: 42 }); // $ExpectType boolean _(numericDictionary).some(); // $ExpectType boolean _(numericDictionary).some(numericDictionaryIterator); // $ExpectType boolean _(numericDictionary).some(subKey); // $ExpectType boolean _(numericDictionary).some([subKey, 42]); // $ExpectType boolean _(numericDictionary).some({ a: 42 }); // $ExpectType boolean _.chain(list).some(); // $ExpectType LoDashExplicitWrapper _.chain(list).some(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).some(subKey); // $ExpectType LoDashExplicitWrapper _.chain(list).some([subKey, 42]); // $ExpectType LoDashExplicitWrapper _.chain(list).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).some(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).some(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).some(subKey); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).some([subKey, 42]); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).some(); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).some(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).some(subKey); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).some([subKey, 42]); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.some(valueIterator, list); // $ExpectType boolean fp.some(subKey)(list); // $ExpectType boolean fp.some({ a: 42 }, list); // $ExpectType boolean fp.some([subKey, 42], list); // $ExpectType boolean fp.some(valueIterator, dictionary); // $ExpectType boolean fp.some(subKey)(dictionary); // $ExpectType boolean fp.some({ a: 42 })(dictionary); // $ExpectType boolean fp.some([subKey, 42])(dictionary); // $ExpectType boolean fp.some(valueIterator, numericDictionary); // $ExpectType boolean fp.some(subKey)(numericDictionary); // $ExpectType boolean fp.some({ a: 42 })(numericDictionary); // $ExpectType boolean fp.some([subKey, 42])(numericDictionary); // $ExpectType boolean } // _.sortBy { _.sortBy(list); // $ExpectType AbcObject[] _.sortBy(list, listIterator); // $ExpectType AbcObject[] _.sortBy(list, listIterator, listIterator); // $ExpectType AbcObject[] _.sortBy(list, [listIterator, listIterator]); // $ExpectType AbcObject[] _.sortBy(list, ""); // $ExpectType AbcObject[] _.sortBy(list, { a: 42 }); // $ExpectType AbcObject[] _.sortBy(dictionary); // $ExpectType AbcObject[] _.sortBy(dictionary, dictionaryIterator); // $ExpectType AbcObject[] _.sortBy(dictionary, ""); // $ExpectType AbcObject[] _.sortBy(dictionary, { a: 42 }); // $ExpectType AbcObject[] _(list).sortBy(); // $ExpectType LoDashImplicitWrapper _(list).sortBy(listIterator); // $ExpectType LoDashImplicitWrapper _(list).sortBy(listIterator, listIterator); // $ExpectType LoDashImplicitWrapper _(list).sortBy([listIterator, listIterator]); // $ExpectType LoDashImplicitWrapper _(list).sortBy(""); // $ExpectType LoDashImplicitWrapper _(list).sortBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper _(dictionary).sortBy(); // $ExpectType LoDashImplicitWrapper _(dictionary).sortBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper _(dictionary).sortBy(""); // $ExpectType LoDashImplicitWrapper _(dictionary).sortBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).sortBy(); // $ExpectType LoDashExplicitWrapper _.chain(list).sortBy(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).sortBy(listIterator, listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).sortBy([listIterator, listIterator]); // $ExpectType LoDashExplicitWrapper _.chain(list).sortBy(""); // $ExpectType LoDashExplicitWrapper _.chain(list).sortBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).sortBy(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).sortBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).sortBy(""); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).sortBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.sortBy(fp.identity, "bca"); // $ExpectType string[] fp.sortBy(valueIterator, list); // $ExpectType AbcObject[] fp.sortBy(valueIterator)(list); // $ExpectType AbcObject[] fp.sortBy([valueIterator, valueIterator])(list); // $ExpectType AbcObject[] fp.sortBy("a", list); // $ExpectType AbcObject[] fp.sortBy({ a: 42 }, list); // $ExpectType AbcObject[] fp.sortBy(fp.identity, dictionary); // $ExpectType AbcObject[] fp.sortBy(valueIterator, dictionary); // $ExpectType AbcObject[] fp.sortBy("a", dictionary); // $ExpectType AbcObject[] fp.sortBy({ a: 42 }, dictionary); // $ExpectType AbcObject[] } // _.orderBy { _.orderBy("acbd", (value) => 1); // $ExpectType string[] _.orderBy("acbd", (value) => 1, true); // $ExpectType string[] _.orderBy("acbd", [(value) => 1, (value) => 2], [true, false]); // $ExpectType string[] _.orderBy(list, (value) => 1); // $ExpectType AbcObject[] _.orderBy(list, (value) => 1, true); // $ExpectType AbcObject[] _.orderBy(list, [(value) => 1, (value) => 2], [true, false]); // $ExpectType AbcObject[] _.orderBy(dictionary, (value) => 1); // $ExpectType AbcObject[] _.orderBy(dictionary, (value) => 1, true); // $ExpectType AbcObject[] _.orderBy(numericDictionary, (value) => 1); // $ExpectType AbcObject[] _.orderBy(numericDictionary, (value) => 1, true); // $ExpectType AbcObject[] _(list).orderBy((value) => 1); // $ExpectType LoDashImplicitWrapper _(list).orderBy((value) => 1, true); // $ExpectType LoDashImplicitWrapper _(list).orderBy([(value) => 1, (value) => 2], true); // $ExpectType LoDashImplicitWrapper _(dictionary).orderBy((value) => 1); // $ExpectType LoDashImplicitWrapper _(dictionary).orderBy((value) => 1, true); // $ExpectType LoDashImplicitWrapper _(numericDictionary).orderBy((value) => 1); // LoDashImplicitWrapper _(numericDictionary).orderBy((value) => 1, true); // LoDashImplicitWrapper _.chain(list).orderBy((value) => 1); // $ExpectType LoDashExplicitWrapper _.chain(list).orderBy((value) => 1, true); // $ExpectType LoDashExplicitWrapper _.chain(list).orderBy([(value) => 1, (value) => 2], true); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).orderBy((value) => 1); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).orderBy((value) => 1, true); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).orderBy((value) => 1); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).orderBy((value) => 1, true); // $ExpectType LoDashExplicitWrapper fp.orderBy(fp.identity, "asc", "bca"); // $ExpectType string[] fp.orderBy(fp.identity, true, "bca"); // $ExpectType string[] fp.orderBy((value: AbcObject) => 1, true, list); // $ExpectType AbcObject[] fp.orderBy([(value: AbcObject) => 1, (value: AbcObject) => 1])([true, false])(list); // $ExpectType AbcObject[] fp.orderBy("a", true, list); // $ExpectType AbcObject[] fp.orderBy({ a: 42 }, true, list); // $ExpectType AbcObject[] fp.orderBy((value: AbcObject) => 1, true, dictionary); // $ExpectType AbcObject[] fp.orderBy("a", true, dictionary); // $ExpectType AbcObject[] fp.orderBy({ a: 42 }, true, dictionary); // $ExpectType AbcObject[] } /******** * Date * ********/ _.now(); // $ExpectType number _({}).now(); // $ExpectType number _.chain({}).now(); // $ExpectType LoDashExplicitWrapper fp.now(); // $ExpectType number /************ * Function * ************/ // _.after { _.after(42, (a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean _(42).after((a: string, b: number): boolean => true); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> _.chain(42).after((a: string, b: number): boolean => true); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> fp.after((a: string, b: number): boolean => true, 42); // $ExpectType (a: string, b: number) => boolean fp.after((a: string, b: number): boolean => true)(42); // $ExpectType (a: string, b: number) => boolean } // _.ary { const func = (a: string, b: number) => true; _.ary(func); // $ExpectType (...args: any[]) => any _.ary(func, 2); // $ExpectType (...args: any[]) => any _(func).ary(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(func).ary(2); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain(func).ary(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(func).ary(2); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.ary(1, func); // $ExpectType (...args: any[]) => any } // _.before { _.before(42, (a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean _(42).before((a: string, b: number): boolean => true); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> _.chain(42).before((a: string, b: number): boolean => true); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> fp.before((a: string, b: number): boolean => true, 42); // $ExpectType (a: string, b: number) => boolean fp.before((a: string, b: number): boolean => true)(42); // $ExpectType (a: string, b: number) => boolean } // _.bind { const func = (a: string, b: number) => true; _.bind(func, anything); // $ExpectType (...args: any[]) => any _.bind(func, anything, 42); // $ExpectType (...args: any[]) => any _.bind(func, anything, 42, ""); // $ExpectType (...args: any[]) => any _(func).bind(anything); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(func).bind(anything, 42); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(func).bind(anything, 42, ""); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain(func).bind(anything); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(func).bind(anything, 42); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(func).bind(anything, 42, ""); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.bind((a: string, b: number) => true, anything); // $ExpectType (...args: any[]) => any fp.bind((a: string, b: number) => true)(anything); // $ExpectType (...args: any[]) => any } // _.bindAll { const object = { a: () => {}, b: () => {}, c: () => {} }; _.bindAll(object); // $ExpectType { a: () => void; b: () => void; c: () => void; } _.bindAll(object, "a", ["b", "c"]); // $ExpectType { a: () => void; b: () => void; c: () => void; } _(object).bindAll(); // $ExpectType LoDashImplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> _(object).bindAll("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> _.chain(object).bindAll(); // $ExpectType LoDashExplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> _.chain(object).bindAll("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> fp.bindAll("a", object); // $ExpectType { a: () => void; b: () => void; c: () => void; } fp.bindAll(["b", "c"])(object); // $ExpectType { a: () => void; b: () => void; c: () => void; } } // _.bindKey { const object = { foo: (a: number, b: string) => true, }; _.bindKey(object, "foo"); // $ExpectType (...args: any[]) => any _.bindKey(object, "foo", 42, ""); // $ExpectType (...args: any[]) => any _(object).bindKey("foo"); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(object).bindKey("foo", 42, ""); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain(object).bindKey("foo"); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(object).bindKey("foo", 42, ""); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.bindKey(object, "foo"); // $ExpectType (...args: any[]) => any fp.bindKey(object)("foo"); // $ExpectType (...args: any[]) => any } // _.curry { const testCurry = (a: string, b: number, c: boolean): [string, number, boolean] => [a, b, c]; _.curry(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] _.curry(testCurry)("1", 2)(true); // $ExpectType [string, number, boolean] _.curry(testCurry)("1")(2, true); // $ExpectType [string, number, boolean] _.curry(testCurry)("1")(2)(true); // $ExpectType [string, number, boolean] _.curry(testCurry)("1", 2); // $ExpectType CurriedFunction1 _.curry(testCurry)("1")(2); // $ExpectType CurriedFunction1 _.curry(testCurry)("1"); // $ExpectType CurriedFunction2 _.curry(testCurry); // $ExpectType CurriedFunction3 _.curry(testCurry)(_, 2, true)("1"); // $ExpectType [string, number, boolean] _.curry(testCurry)(_.curry.placeholder, 2, true)("1"); // $ExpectType [string, number, boolean] _.curry(testCurry)("1", _, true)(2); // $ExpectType [string, number, boolean] _.curry(testCurry)(_, 2)("1", true); // $ExpectType [string, number, boolean] _.curry(testCurry)(_.curry.placeholder, 2)("1", true); // $ExpectType [string, number, boolean] _(testCurry).curry(); // $ExpectType LoDashImplicitWrapper> _.chain(testCurry).curry(); // $ExpectType LoDashExplicitWrapper> fp.curry(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] fp.curry(testCurry)("1", 2)(true); // $ExpectType [string, number, boolean] fp.curry(testCurry)("1")(2, true); // $ExpectType [string, number, boolean] fp.curry(testCurry)("1")(2)(true); // $ExpectType [string, number, boolean] fp.curry(testCurry)("1", 2); // $ExpectType CurriedFunction1 fp.curry(testCurry)("1")(2); // $ExpectType CurriedFunction1 fp.curry(testCurry)("1"); // $ExpectType CurriedFunction2 fp.curry(testCurry); // $ExpectType CurriedFunction3 fp.curry(testCurry)(fp.__, 2, true)("1"); // $ExpectType [string, number, boolean] fp.curry(testCurry)(fp.curry.placeholder, 2, true)("1"); // $ExpectType [string, number, boolean] fp.curryN(3)(testCurry)(fp.curryN.placeholder, 2, true)("1"); // $ExpectType [string, number, boolean] // _.curryRight _.curryRight(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] _.curryRight(testCurry)(2, true)("1"); // $ExpectType [string, number, boolean] _.curryRight(testCurry)(true)("1", 2); // $ExpectType [string, number, boolean] _.curryRight(testCurry)(true)(2)("1"); // $ExpectType [string, number, boolean] _.curryRight(testCurry)(2, true); // $ExpectType RightCurriedFunction1 _.curryRight(testCurry)(true)(2); // $ExpectType RightCurriedFunction1 _.curryRight(testCurry)(true); // $ExpectType RightCurriedFunction2 _.curryRight(testCurry); // $ExpectType RightCurriedFunction3 _.curryRight(testCurry)("1", _, true)(2); // $ExpectType [string, number, boolean] _.curryRight(testCurry)("1", _.curryRight.placeholder, true)(2); // $ExpectType [string, number, boolean] _.curryRight(testCurry)(true)("1", _)(2); // $ExpectType [string, number, boolean] _.curryRight(testCurry)(true)("1", _.curryRight.placeholder)(2); // $ExpectType [string, number, boolean] _(testCurry).curryRight(); // $ExpectType LoDashImplicitWrapper> _.chain(testCurry).curryRight(); // $ExpectType LoDashExplicitWrapper> fp.curryRight(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] fp.curryRight(testCurry)(true)("1", 2); // $ExpectType [string, number, boolean] fp.curryRight(testCurry)(2, true)("1"); // $ExpectType [string, number, boolean] fp.curryRight(testCurry)(true)(2)("1"); // $ExpectType [string, number, boolean] fp.curryRight(testCurry)(2, true); // $ExpectType RightCurriedFunction1 fp.curryRight(testCurry)(true)(2); // $ExpectType RightCurriedFunction1 fp.curryRight(testCurry)(true); // $ExpectType RightCurriedFunction2 fp.curryRight(testCurry); // $ExpectType RightCurriedFunction3 fp.curryRight(testCurry)("1", fp.__, true)(2); // $ExpectType [string, number, boolean] fp.curryRight(testCurry)("1", fp.curryRight.placeholder, true)(2); // $ExpectType [string, number, boolean] fp.curryRightN(3)(testCurry)("1", fp.curryRightN.placeholder, true)(2); // $ExpectType [string, number, boolean] } // _.debounce { const func = (n: number, s: string): boolean => true; const options: _.DebounceSettings = { leading: true, maxWait: 100, trailing: false, }; const result = _.debounce(func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable result.cancel(); // $ExpectType void result.flush(); // $ExpectType void _.debounce(func, 42); // $ExpectType ((n: number, s: string) => boolean) & Cancelable _.debounce(func, 42, options); // $ExpectType ((n: number, s: string) => boolean) & Cancelable _(func).debounce(42, options); // $ExpectType LoDashImplicitWrapper<((n: number, s: string) => boolean) & Cancelable> _.chain(func).debounce(42, options); // $ExpectType LoDashExplicitWrapper<((n: number, s: string) => boolean) & Cancelable> fp.debounce(42, func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable fp.debounce(42)(func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable } // _.defer { const func = (a: number, b: string) => true; _.defer(func); // $ExpectType number _.defer(func, anything, anything, anything); // $ExpectType number _(func).defer(); // $ExpectType LoDashImplicitWrapper _(func).defer(anything, anything, anything); // $ExpectType LoDashImplicitWrapper _.chain(func).defer(); // $ExpectType LoDashExplicitWrapper _.chain(func).defer(anything, anything, anything); // $ExpectType LoDashExplicitWrapper fp.defer(func); // $ExpectType number } // _.delay { const func = (a: number, b: string) => true; _.delay(func, 500); // $ExpectType number _.delay(func, 500, anything, anything); // $ExpectType number _(func).delay(500); // $ExpectType LoDashImplicitWrapper _(func).delay(500, anything, anything); // $ExpectType LoDashImplicitWrapper _.chain(func).delay(500); // $ExpectType LoDashExplicitWrapper _.chain(func).delay(500, anything, anything); // $ExpectType LoDashExplicitWrapper fp.delay(500, func); // $ExpectType number fp.delay(500)(func); // $ExpectType number } // _.flip { // TODO: fix - output arguments should be reversed _.flip((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean _((a: string, b: number): boolean => true).flip(); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> _.chain((a: string, b: number): boolean => true).flip(); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> fp.flip((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean } // _.flow // _.flowRight { const fn1 = (n: number): number => 0; const fn2 = (m: number, n: number): number => 0; const fn3 = (a: number): string => ""; const fn4 = (a: string): boolean => true; const fn5 = (): number => 0; _.flow(fn2, fn1); // $ExpectType (a1: number, a2: number) => number _.flow(fn2, fn1, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number _.flow(fn2, fn1, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean _.flow([fn2, fn1, fn3, fn4]); // $ExpectType (...args: any[]) => any _.flow(fn5, fn1); // $ExpectType () => number _(fn2).flow(fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> _(fn2).flow(fn1, fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> _(fn2).flow(fn1, fn1, fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> _(fn2).flow([fn1, fn1, fn1]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(fn5).flow(fn1); // $ExpectType LoDashImplicitWrapper<() => number> _.chain(fn2).flow(fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> _.chain(fn2).flow(fn1, fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> _.chain(fn2).flow(fn1, fn1, fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> _.chain(fn2).flow([fn1, fn1, fn1]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(fn5).flow(fn1); // $ExpectType LoDashExplicitWrapper<() => number> fp.flow(fn1, fn1); // $ExpectType (a1: number) => number fp.flow(fn1, fn3); // $ExpectType (a1: number) => string fp.flow(fn2, fn1, fn1); // $ExpectType (a1: number, a2: number) => number fp.flow(fn2, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number fp.flow(fn2, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number fp.flow(fn2, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number fp.flow(fn2, fn1, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number fp.flow(fn2, fn3); // $ExpectType (a1: number, a2: number) => string fp.flow(fn2, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean fp.flow(fn2, fn1, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean fp.flow([fn2, fn1, fn3, fn4]); // $ExpectType (...args: any[]) => any fp.flow(fn5, fn1); // $ExpectType () => number _.flowRight(fn1, fn2); // $ExpectType (a1: number, a2: number) => number _.flowRight(fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number _.flowRight(fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number _.flowRight([fn1, fn1, fn1, fn2]); // $ExpectType (...args: any[]) => any _.flowRight(fn1, fn5); // $ExpectType () => number _(fn1).flowRight(fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> _(fn1).flowRight(fn1, fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> _(fn1).flowRight(fn1, fn1, fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> _(fn1).flowRight([fn1, fn1, fn2]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(fn1).flowRight(fn5); // $ExpectType LoDashImplicitWrapper<() => number> _.chain(fn1).flowRight(fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> _.chain(fn1).flowRight(fn1, fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> _.chain(fn1).flowRight(fn1, fn1, fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> _.chain(fn1).flowRight([fn1, fn1, fn2]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(fn1).flowRight(fn5); // $ExpectType LoDashExplicitWrapper<() => number> fp.flowRight(fn1, fn1); // $ExpectType (a1: number) => number fp.flowRight(fn3, fn1); // $ExpectType (a1: number) => string fp.flowRight(fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number fp.flowRight(fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number fp.flowRight(fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number fp.flowRight(fn1, fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number fp.flowRight(fn1, fn1, fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number fp.flowRight(fn3, fn2); // $ExpectType (a1: number, a2: number) => string fp.flowRight(fn4, fn3, fn2); // $ExpectType (a1: number, a2: number) => boolean fp.flowRight(fn4, fn3, fn1, fn2); // $ExpectType (a1: number, a2: number) => boolean fp.flowRight([fn4, fn3, fn1, fn2]); // $ExpectType (...args: any[]) => any fp.flowRight(fn1, fn5); // $ExpectType () => number } // _.memoize { const memoizedFunction: _.MemoizedFunction = anything; memoizedFunction.cache; // $ExpectType MapCache const testMapCache: _.MapCache = { delete(key: string) { return true; }, get(key: string): any { return 1; }, has(key: string) { return true; }, set(key: string, value: any): _.MapCache { return this; }, clear() { }, }; const memoizeFn = (a1: string, a2: number): boolean => true; const memoizeResolverFn = (a1: string, a2: number) => ""; _.memoize(memoizeFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction _.memoize(memoizeFn, memoizeResolverFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction _(memoizeFn).memoize(); // $ExpectType LoDashImplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> _(memoizeFn).memoize(memoizeResolverFn); // $ExpectType LoDashImplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> _.chain(memoizeFn).memoize(); // $ExpectType LoDashExplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> _.chain(memoizeFn).memoize(memoizeResolverFn); // $ExpectType LoDashExplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> fp.memoize(memoizeFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction // $ExpectType MapCache new _.memoize.Cache(); _.memoize.Cache = WeakMap; _.memoize.Cache = Map; const memoizedFn = _.memoize(memoizeFn); memoizedFn.cache = new WeakMap(); memoizedFn.cache = new Map(); } // _.overArgs { const func = (a: number, b: string) => true; _.overArgs(func, (a: number) => true, (b: string) => true); // $ExpectType (...args: any[]) => any _.overArgs(func, [(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any _(func).overArgs((a: number) => true, (b: string) => true); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(func).overArgs([(a: number) => true, (b: string) => true]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain(func).overArgs((a: number) => true, (b: string) => true); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(func).overArgs([(a: number) => true, (b: string) => true]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.overArgs(func, [(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any fp.overArgs(func)([(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any } // _.negate { _.negate((a1: number, a2: number): boolean => true); // $ExpectType (a1: number, a2: number) => boolean _((a1: number, a2: number): boolean => true).negate(); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => boolean> _.chain((a1: number, a2: number): boolean => true).negate(); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => boolean> fp.negate((a1: number, a2: number): boolean => true); // $ExpectType (a1: number, a2: number) => boolean const userDefinedTypeGuard = (item: any): item is number => typeof item === "number"; _.negate(userDefinedTypeGuard); // $ExpectType (a1: any) => boolean _(userDefinedTypeGuard).negate(); // $ExpectType LoDashImplicitWrapper<(a1: any) => boolean> _.chain(userDefinedTypeGuard).negate(); // $ExpectType LoDashExplicitWrapper<(a1: any) => boolean> fp.negate(userDefinedTypeGuard); // $ExpectType (a1: any) => boolean _.negate((a1: number, a2: number, a3: number): boolean => true); // $ExpectType (...args: any[]) => boolean _((a1: number, a2: number, a3: number): boolean => true).negate(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => boolean> _.chain((a1: number, a2: number, a3: number): boolean => true).negate(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => boolean> fp.negate((a1: number, a2: number, a3: number): boolean => true); // $ExpectType (...args: any[]) => boolean } // _.once { _.once((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean _((a: string, b: number): boolean => true).once(); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> _.chain((a: string, b: number): boolean => true).once(); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> fp.once((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean } // _.rearg { const testReargFn = (a: string, b: string, c: string) => [a, b, c]; _.rearg(testReargFn, 2, 0, 1); // $ExpectType (...args: any[]) => any _.rearg(testReargFn, [2, 0, 1]); // $ExpectType (...args: any[]) => any _(testReargFn).rearg(2, 0, 1); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(testReargFn).rearg([2, 0, 1]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain(testReargFn).rearg(2, 0, 1); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(testReargFn).rearg([2, 0, 1]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.rearg([2, 0, 1], testReargFn); // $ExpectType (...args: any[]) => any fp.rearg([2, 0, 1])(testReargFn); // $ExpectType (...args: any[]) => any } // _.rest { _.rest((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any _.rest((a: string, b: number[]) => true, 1); // $ExpectType (...args: any[]) => any _((a: string, b: number[]) => true).rest(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _((a: string, b: number[]) => true).rest(1); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain((a: string, b: number[]) => true).rest(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain((a: string, b: number[]) => true).rest(1); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.rest((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any fp.restFrom(1)((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any } // _.spread { _.spread((a: Array): boolean => true); // $ExpectType (...args: any[]) => boolean _((a: Array): boolean => true).spread(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => boolean> _.chain((a: Array): boolean => true).spread(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => boolean> fp.spread((a: Array): boolean => true); // $ExpectType (...args: any[]) => boolean } // _.throttle { const options: _.ThrottleSettings = { leading: true, trailing: false, }; const func = (a: number, b: string): boolean => true; _.throttle(func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable _.throttle(func, 42); // $ExpectType ((a: number, b: string) => boolean) & Cancelable _.throttle(func, 42, options); // $ExpectType ((a: number, b: string) => boolean) & Cancelable _(func).throttle(); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> _(func).throttle(42); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> _(func).throttle(42, options); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> _.chain(func).throttle(); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> _.chain(func).throttle(42); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> _.chain(func).throttle(42, options); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> fp.throttle(42, func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable fp.throttle(42)(func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable } // _.unary { _.unary((a: string, b: number): boolean => true); // $ExpectType (arg1: string) => boolean _((a: string, b: number): boolean => true).unary(); // $ExpectType LoDashImplicitWrapper<(arg1: string) => boolean> _.chain((a: string, b: number): boolean => true).unary(); // $ExpectType LoDashExplicitWrapper<(arg1: string) => boolean> fp.unary((a: string, b: number): boolean => true); // $ExpectType (arg1: string) => boolean } // _.wrap { _.wrap("a", (arg1: string, ...args: number[]): boolean => true); // $ExpectType (...args: number[]) => boolean _("a").wrap((arg1: string, ...args: number[]): boolean => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> _.chain("a").wrap((arg1: string, ...args: number[]): boolean => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> fp.wrap((arg1: string, ...args: number[]): boolean => true, "a"); // $ExpectType (...args: number[]) => boolean fp.wrap((arg1: string, ...args: number[]): boolean => true)("a"); // $ExpectType (...args: number[]) => boolean } /******** * Lang * ********/ // _.castArray { _.castArray(42); // $ExpectType number[] _.castArray([42]); // $ExpectType number[] _.castArray({ a: 42 }); // $ExpectType { a: number; }[] _(42).castArray(); // $ExpectType LoDashImplicitWrapper _([42]).castArray(); // $ExpectType LoDashImplicitWrapper _.chain(42).castArray(); // $ExpectType LoDashExplicitWrapper _.chain([42]).castArray(); // $ExpectType LoDashExplicitWrapper fp.castArray(42); // $ExpectType number[] fp.castArray([42]); // $ExpectType number[] } // _.clone { _.clone(42); // $ExpectType 42 _.clone({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } _(42).clone(); // $ExpectType number _({ a: { b: 42 } }).clone(); // $ExpectType { a: { b: number; }; } _.chain(42).clone(); // $ExpectType LoDashExplicitWrapper _.chain({ a: { b: 42 } }).clone(); // $ExpectType LoDashExplicitWrapper<{ a: { b: number; }; }> fp.clone(42); // $ExpectType 42 fp.clone({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } } // _.cloneDeep { _.cloneDeep(42); // $ExpectType 42 _.cloneDeep({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } _(42).cloneDeep(); // $ExpectType number _({ a: { b: 42 } }).cloneDeep(); // $ExpectType { a: { b: number; }; } _.chain(42).cloneDeep(); // $ExpectType LoDashExplicitWrapper _.chain({ a: { b: 42 } }).cloneDeep(); // $ExpectType LoDashExplicitWrapper<{ a: { b: number; }; }> fp.cloneDeep(42); // $ExpectType 42 fp.cloneDeep({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } } // _.cloneDeepWith { const customizer = (x: any) => ""; _.cloneDeepWith(42, customizer); // $ExpectType any _(42).cloneDeepWith(customizer); // $ExpectType any _.chain(42).cloneDeepWith(customizer); // $ExpectType LoDashExplicitWrapper _.cloneDeepWith({a: {b: 42}}, customizer); // $ExpectType any fp.cloneDeepWith((x) => "", 42); // $ExpectType any fp.cloneDeepWith((x) => "")(42); // $ExpectType any fp.cloneDeepWith((x) => "", [42]); // $ExpectType any fp.cloneDeepWith((x) => "", { a: { b: 42 } }); // $ExpectType any } // _.cloneWith { { const customizer = (x: number) => ""; _.cloneWith(42, customizer); // $ExpectType string _(42).cloneWith(customizer); // $ExpectType string _.chain(42).cloneWith(customizer); // $ExpectType LoDashExplicitWrapper fp.cloneWith(customizer, 42); // $ExpectType string fp.cloneWith(customizer)(42); // $ExpectType string } { const customizer = (x: number): string | undefined => ""; const value: number = anything; _.cloneWith(value, customizer); // string | number _(value).cloneWith(customizer); // string | number _.chain(value).cloneWith(customizer); // string | number fp.cloneWith(customizer, value); // $ExpectType string | number fp.cloneWith(customizer)(value); // $ExpectType string | number } } // _.conforms { _.conforms({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean fp.conforms({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean } // _.conformsTo { _.conformsTo({ foo: "foo" }, { foo: (v: string) => false }); // $ExpectType boolean _({ foo: "foo" }).conformsTo({ foo: (v: string) => false }); // $ExpectType boolean _.chain({ foo: "foo" }).conformsTo({ foo: (v: string) => false }); // $ExpectType LoDashExplicitWrapper fp.conformsTo({ foo: (v: string) => false }, { foo: "foo" }); // $ExpectType boolean fp.conformsTo({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean } // _.eq { _.eq(anything, anything); // $ExpectType boolean _(anything).eq(anything); // $ExpectType boolean _.chain(anything).eq(anything); // $ExpectType LoDashExplicitWrapper fp.eq(anything, anything); // $ExpectType boolean fp.eq(anything)(anything); // $ExpectType boolean } // _.gt { _.gt(anything, anything); // $ExpectType boolean _(anything).gt(anything); // $ExpectType boolean _.chain(anything).gt(anything); // $ExpectType LoDashExplicitWrapper fp.gt(anything, anything); // $ExpectType boolean fp.gt(anything)(anything); // $ExpectType boolean } // _.gte { _.gte(anything, anything); // $ExpectType boolean _(anything).gte(anything); // $ExpectType boolean _.chain(anything).gte(anything); // $ExpectType LoDashExplicitWrapper fp.gte(anything, anything); // $ExpectType boolean fp.gte(anything)(anything); // $ExpectType boolean } // _.isArguments { const value: number | IArguments = 0; if (_.isArguments(value)) { const result: IArguments = value; } else { value; // $ExpectType number } if (fp.isArguments(value)) { const result: IArguments = value; } else { value; // $ExpectType number } _.isArguments(""); // $ExpectType boolean _({}).isArguments(); // $ExpectType boolean _.chain([]).isArguments(); // $ExpectType LoDashExplicitWrapper fp.isArguments(anything); // $ExpectType boolean } // _.isArray { const value: number | string[] | boolean[] = anything; if (_.isArray(value)) { const result: string[] | boolean[] = value; } else { value; // $ExpectType number } if (fp.isArray(value)) { const result: string[] | boolean[] = value; } else { value; // $ExpectType number } _.isArray(anything); // $ExpectType boolean _({}).isArray(); // $ExpectType boolean _.chain([]).isArray(); // $ExpectType LoDashExplicitWrapper fp.isArray(anything); // $ExpectType boolean } // _.isArrayBuffer { const value: ArrayBuffer | number = anything; if (_.isArrayBuffer(value)) { value; // $ExpectType ArrayBuffer } else { value; // $ExpectType number } if (fp.isArrayBuffer(value)) { value; // $ExpectType ArrayBuffer } else { value; // $ExpectType number } _.isArrayBuffer(anything); // $ExpectType boolean _({}).isArrayBuffer(); // $ExpectType boolean _.chain([]).isArrayBuffer(); // $ExpectType LoDashExplicitWrapper fp.isArrayBuffer(anything); // $ExpectType boolean } // _.isArrayLike { { const value: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] | number | { length: string } | { a: string } | null | undefined = anything; if (_.isArrayLike(value)) { const result: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; } else { const result: number | { length: string } | { a: string; } | null | undefined = value; } if (fp.isArrayLike(value)) { const result: string | string[] | { [index: number]: boolean; length: number; } | [number, boolean] = value; } else { const result: number | { length: string; } | { a: string; } | null | undefined = value; } } { const value: boolean[] = anything; if (_.isArrayLike(value)) { const result: boolean[] = value; } else { value; // $ExpectType never } if (fp.isArrayLike(value)) { value; // $ExpectType boolean[] } else { value; // $ExpectType never } } { const value: () => number = anything; if (_.isArrayLike(value)) { value; // $ExpectType never } else { value; // $ExpectType () => number } if (fp.isArrayLike(value)) { value; // $ExpectType never } else { value; // $ExpectType () => number } } { const value: { a: string } = anything; if (_.isArrayLike(value)) { const result: { a: string, length: number } = value; } else { value; // $ExpectType { a: string; } } if (fp.isArrayLike(value)) { const result: { a: string, length: number } = value; } else { value; // $ExpectType { a: string; } } } { const value: any = anything; if (_.isArrayLike(value)) { value; // $ExpectType any } else { value; // $ExpectType any } if (fp.isArrayLike(value)) { value; // $ExpectType any } else { value; // $ExpectType any } } _.isArrayLike(anything); // $ExpectType boolean _({}).isArrayLike(); // $ExpectType boolean _.chain([]).isArrayLike(); // $ExpectType LoDashExplicitWrapper fp.isArrayLike(anything); // $ExpectType boolean } // _.isArrayLikeObject { { const value: string[] | { [index: number]: boolean, length: number } | [number, boolean] | number | string | { length: string } | { a: string } | null | undefined = anything; if (_.isArrayLikeObject(value)) { const result: string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; } else { const result: string | number | { length: string; } | { a: string; } | null | undefined = value; } if (fp.isArrayLikeObject(value)) { const result: string[] | [number, boolean] | { [index: number]: boolean; length: number; } = value; } else { const result: string | number | { length: string; } | { a: string; } | null | undefined = value; } } { const value: boolean[] = anything; if (_.isArrayLikeObject(value)) { const result: boolean[] = value; } else { value; // $ExpectType never } if (fp.isArrayLikeObject(value)) { const result: boolean[] = value; } else { value; // $ExpectType never } } { const value: (a: string) => boolean = anything; if (_.isArrayLikeObject(value)) { value; // $ExpectType never } else { value; // $ExpectType (a: string) => boolean } if (fp.isArrayLikeObject(value)) { value; // $ExpectType never } else { value; // $ExpectType (a: string) => boolean } } { const value: { a: string } = anything; if (_.isArrayLikeObject(value)) { const result: { a: string, length: number } = value; } else { value; // $ExpectType { a: string; } } if (fp.isArrayLikeObject(value)) { const result: { a: string, length: number } = value; } else { value; // $ExpectType { a: string; } } } { const value: any = anything; if (_.isArrayLikeObject(value)) { value; // $ExpectType any } else { value; // $ExpectType any } if (fp.isArrayLikeObject(value)) { value; // $ExpectType any } else { value; // $ExpectType any } } _.isArrayLikeObject(anything); // $ExpectType boolean _({}).isArrayLikeObject(); // $ExpectType boolean _.chain([]).isArrayLikeObject(); // $ExpectType LoDashExplicitWrapper fp.isArrayLikeObject(anything); // $ExpectType boolean } // _.isBoolean { const value: number | boolean = 0; if (_.isBoolean(value)) { const result: boolean = value; } else { value; // $ExpectType number } if (fp.isBoolean(value)) { const result: boolean = value; } else { value; // $ExpectType number } _.isBoolean(anything); // $ExpectType boolean _({}).isBoolean(); // $ExpectType boolean _.chain([]).isBoolean(); // $ExpectType LoDashExplicitWrapper } // _.isBuffer { _.isBuffer(anything); // $ExpectType boolean _({}).isBuffer(); // $ExpectType boolean _.chain([]).isBuffer(); // $ExpectType LoDashExplicitWrapper fp.isBuffer(anything); // $ExpectType boolean } // _.isDate { const value: number | Date = 0; if (_.isDate(value)) { const result: Date = value; } else { value; // $ExpectType number } if (fp.isDate(value)) { const date: Date = value; } else { value; // $ExpectType number } _.isDate(anything); // $ExpectType boolean _({}).isDate(); // $ExpectType boolean _.chain([]).isDate(); // $ExpectType LoDashExplicitWrapper fp.isDate(anything); // $ExpectType boolean } // _.isElement { _.isElement(anything); // $ExpectType boolean _({}).isElement(); // $ExpectType boolean _.chain([]).isElement(); // $ExpectType LoDashExplicitWrapper fp.isElement(anything); // $ExpectType boolean } // _.isEmpty { _.isEmpty(anything); // $ExpectType boolean _({}).isEmpty(); // $ExpectType boolean _.chain([]).isEmpty(); // $ExpectType LoDashExplicitWrapper fp.isEmpty(anything); // $ExpectType boolean } // _.isEqual { _.isEqual(anything, anything); // $ExpectType boolean _(anything).isEqual(anything); // $ExpectType boolean _.chain(anything).isEqual(anything); // $ExpectType LoDashExplicitWrapper fp.isEqual(anything, anything); // $ExpectType boolean fp.isEqual(anything)(anything); // $ExpectType boolean fp.equals(anything)(anything); // $ExpectType boolean } // _.isEqualWith { const customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true; _.isEqualWith(anything, anything, customizer); // $ExpectType boolean _(anything).isEqualWith(anything, customizer); // $ExpectType boolean _.chain(anything).isEqualWith(anything, customizer); // $ExpectType LoDashExplicitWrapper fp.isEqualWith(customizer, anything, anything); // $ExpectType boolean fp.isEqualWith(customizer)(anything)(anything); // $ExpectType boolean } // _.isError { { const value: number | Error = anything; if (_.isError(value)) { value; // $ExpectType Error } else { value; // $ExpectType number } if (fp.isError(value)) { value; // $ExpectType Error } else { value; // $ExpectType number } } { class CustomError extends Error { custom: string; } const value: number | CustomError = anything; if (_.isError(value)) { value; // $ExpectType CustomError } else { value; // $ExpectType number } if (fp.isError(value)) { value; // $ExpectType CustomError } else { value; // $ExpectType number } } _.isError(anything); // $ExpectType boolean _({}).isError(); // $ExpectType boolean _.chain([]).isError(); // $ExpectType LoDashExplicitWrapper fp.isError(anything); // $ExpectType boolean } // _.isFinite { _.isFinite(NaN); // $ExpectType boolean _(42).isFinite(); // $ExpectType boolean _.chain([]).isFinite(); // $ExpectType LoDashExplicitWrapper fp.isFinite(anything); // $ExpectType boolean } // _.isFunction { const value: number | (() => void) = anything; if (_.isFunction(value)) { value; // $ExpectType () => void } else { value; // $ExpectType number } if (fp.isFunction(value)) { value; // $ExpectType () => void } else { value; // $ExpectType number } if (_.isFunction(anything)) { anything(); } if (fp.isFunction(anything)) { anything(); } _.isFunction(anything); // $ExpectType boolean _({}).isFunction(); // $ExpectType boolean _.chain([]).isFunction(); // $ExpectType LoDashExplicitWrapper fp.isFunction(anything); // $ExpectType boolean } // _.isInteger { _.isInteger(NaN); // $ExpectType boolean _(42).isInteger(); // $ExpectType boolean _.chain([]).isInteger(); // $ExpectType LoDashExplicitWrapper fp.isInteger(anything); // $ExpectType boolean } // _.isLength { _.isLength(NaN); // $ExpectType boolean _(42).isLength(); // $ExpectType boolean _.chain([]).isLength(); // $ExpectType LoDashExplicitWrapper fp.isLength(anything); // $ExpectType boolean } // _.isMap { const value: number | Map = 0; if (_.isMap(value)) { const result: Map = value; } else { const result: number = value; } if (fp.isMap(value)) { const result: Map = value; } else { const result: number = value; } _.isMap(anything); // $ExpectType boolean _({}).isMap(); // $ExpectType boolean _.chain([]).isMap(); // $ExpectType LoDashExplicitWrapper fp.isMap(anything); // $ExpectType boolean } // _.isMatch { _.isMatch({}, {}); // $ExpectType boolean _({}).isMatch({}); // $ExpectType boolean _.chain({}).isMatch({}); // $ExpectType LoDashExplicitWrapper fp.isMatch({}, {}); // $ExpectType boolean fp.isMatch({})({}); // $ExpectType boolean } // _.isMatchWith { const testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol, object: object, source: object) => true; _.isMatchWith({}, {}, testIsMatchCustiomizerFn); // $ExpectType boolean _({}).isMatchWith({}, testIsMatchCustiomizerFn); // $ExpectType boolean _.chain({}).isMatchWith({}, testIsMatchCustiomizerFn); // $ExpectType LoDashExplicitWrapper fp.isMatchWith(testIsMatchCustiomizerFn, {}, {}); // $ExpectType boolean fp.isMatchWith(testIsMatchCustiomizerFn)({})({}); // $ExpectType boolean } // _.isNaN { _.isNaN(NaN); // $ExpectType boolean _(42).isNaN(); // $ExpectType boolean _.chain([]).isNaN(); // $ExpectType LoDashExplicitWrapper fp.isNaN(anything); // $ExpectType boolean } // _.isNative { const value: number | (() => void) = anything; if (_.isNative(value)) { value; // $ExpectType () => void } else { value; // $ExpectType number } if (fp.isNative(value)) { value; // $ExpectType () => void } else { value; // $ExpectType number } _.isNative(anything); // $ExpectType boolean _({}).isNative(); // $ExpectType boolean _.chain([]).isNative(); // $ExpectType LoDashExplicitWrapper fp.isNative(anything); // $ExpectType boolean } // _.isNil { _.isNil(null); // $ExpectType boolean _(undefined).isNil(); // $ExpectType boolean _.chain(NaN).isNil(); // $ExpectType LoDashExplicitWrapper fp.isNil(undefined); // $ExpectType boolean } // _.isNull { _.isNull(null); // $ExpectType boolean _(undefined).isNull(); // $ExpectType boolean _.chain(NaN).isNull(); // $ExpectType LoDashExplicitWrapper fp.isNull(undefined); // $ExpectType boolean } // _.isNumber { const value: string | number = 0; if (_.isNumber(value)) { const result: number = value; } else { const result: string = value; } if (fp.isNumber(value)) { const result: number = value; } else { const result: string = value; } _.isNumber(NaN); // $ExpectType boolean _(42).isNumber(); // $ExpectType boolean _.chain([]).isNumber(); // $ExpectType LoDashExplicitWrapper fp.isNumber(anything); // $ExpectType boolean } // _.isObject { _.isObject(NaN); // $ExpectType boolean _(42).isObject(); // $ExpectType boolean _.chain([]).isObject(); // $ExpectType LoDashExplicitWrapper fp.isObject(anything); // $ExpectType boolean if (fp.isObject(anything)) { anything; // $ExpectType object } if (_.isObject(anything)) { anything; // $ExpectType object } } // _.isObjectLike { _.isObjectLike(NaN); // $ExpectType boolean _(42).isObjectLike(); // $ExpectType boolean _.chain([]).isObjectLike(); // $ExpectType LoDashExplicitWrapper fp.isObjectLike(anything); // $ExpectType boolean } // _.isPlainObject { _.isPlainObject(NaN); // $ExpectType boolean _(42).isPlainObject(); // $ExpectType boolean _.chain([]).isPlainObject(); // $ExpectType LoDashExplicitWrapper fp.isPlainObject(anything); // $ExpectType boolean } // _.isRegExp { { const value: number | RegExp = anything; if (_.isRegExp(value)) { const result: RegExp = value; } else { const result: number = value; } if (fp.isRegExp(value)) { const result: RegExp = value; } else { const result: number = value; } } _.isRegExp(/./); // $ExpectType boolean _(42).isRegExp(); // $ExpectType boolean _.chain([]).isRegExp(); // $ExpectType LoDashExplicitWrapper fp.isRegExp(anything); // $ExpectType boolean } // _.isSafeInteger { _.isSafeInteger(NaN); // $ExpectType boolean _(42).isSafeInteger(); // $ExpectType boolean _.chain([]).isSafeInteger(); // $ExpectType LoDashExplicitWrapper fp.isSafeInteger(anything); // $ExpectType boolean } // _.isSet { const value: number | Set = 0; if (_.isSet(value)) { const result: Set = value; } else { const result: number = value; } if (fp.isSet(value)) { const result: Set = value; } else { const result: number = value; } _.isSet(NaN); // $ExpectType boolean _(42).isSet(); // $ExpectType boolean _.chain([]).isSet(); // $ExpectType LoDashExplicitWrapper fp.isSet(anything); // $ExpectType boolean } // _.isString { const value: number | string = ""; if (_.isString(value)) { const result: string = value; } else { const result: number = value; } if (fp.isString(value)) { const result: string = value; } else { const result: number = value; } _.isString(""); // $ExpectType boolean _(42).isString(); // $ExpectType boolean _.chain([]).isString(); // $ExpectType LoDashExplicitWrapper fp.isString(anything); // $ExpectType boolean } // _.isSymbol { _.isSymbol(NaN); // $ExpectType boolean _(42).isSymbol(); // $ExpectType boolean _.chain([]).isSymbol(); // $ExpectType LoDashExplicitWrapper fp.isSymbol(anything); // $ExpectType boolean } // _.isTypedArray { _.isTypedArray(NaN); // $ExpectType boolean _(42).isTypedArray(); // $ExpectType boolean _.chain([]).isTypedArray(); // $ExpectType LoDashExplicitWrapper fp.isTypedArray(anything); // $ExpectType boolean } // _.isUndefined { _.isUndefined(null); // $ExpectType boolean _(undefined).isUndefined(); // $ExpectType boolean _.chain(NaN).isUndefined(); // $ExpectType LoDashExplicitWrapper fp.isUndefined(undefined); // $ExpectType boolean } // _.isWeakMap { const value: number | WeakMap = 0; if (_.isWeakMap(value)) { const result: WeakMap = value; } else { const result: number = value; } if (fp.isWeakMap(value)) { const result: WeakMap = value; } else { const result: number = value; } _.isWeakMap(NaN); // $ExpectType boolean _(42).isWeakMap(); // $ExpectType boolean _.chain([]).isWeakMap(); // $ExpectType LoDashExplicitWrapper fp.isWeakMap(anything); // $ExpectType boolean } // _.isWeakSet { const value: number | WeakSet = 0; if (_.isWeakSet(value)) { const result: WeakSet = value; } else { const result: number = value; } if (fp.isWeakSet(value)) { const result: WeakSet = value; } else { const result: number = value; } _.isWeakSet(NaN); // $ExpectType boolean _(42).isWeakSet(); // $ExpectType boolean _.chain([]).isWeakSet(); // $ExpectType LoDashExplicitWrapper fp.isWeakSet(anything); // $ExpectType boolean } // _.lt { _.lt(anything, anything); // $ExpectType boolean _(anything).lt(anything); // $ExpectType boolean _.chain(anything).lt(anything); // $ExpectType LoDashExplicitWrapper fp.lt(anything, anything); // $ExpectType boolean fp.lt(anything)(anything); // $ExpectType boolean } // _.lte { _.lte(anything, anything); // $ExpectType boolean _(anything).lte(anything); // $ExpectType boolean _.chain(anything).lte(anything); // $ExpectType LoDashExplicitWrapper fp.lte(anything, anything); // $ExpectType boolean fp.lte(anything)(anything); // $ExpectType boolean } // _.toArray { const array: AbcObject[] = []; const list: _.List = []; const dictionary: _.Dictionary = {}; const numericDictionary: _.NumericDictionary = {}; _.toArray(""); // $ExpectType string[] _.toArray(array); // $ExpectType AbcObject[] _.toArray(list); // $ExpectType AbcObject[] _.toArray(dictionary); // $ExpectType AbcObject[] _.toArray(numericDictionary); // $ExpectType AbcObject[] _(array).toArray(); // $ExpectType LoDashImplicitWrapper _(list).toArray(); // $ExpectType LoDashImplicitWrapper _(dictionary).toArray(); // $ExpectType LoDashImplicitWrapper _(numericDictionary).toArray(); // $ExpectType LoDashImplicitWrapper _.chain(array).toArray(); // $ExpectType LoDashExplicitWrapper _.chain(list).toArray(); // $ExpectType LoDashExplicitWrapper _.chain(dictionary).toArray(); // $ExpectType LoDashExplicitWrapper _.chain(numericDictionary).toArray(); // $ExpectType LoDashExplicitWrapper fp.toArray(""); // $ExpectType string[] fp.toArray(array); // $ExpectType AbcObject[] fp.toArray(list); // $ExpectType AbcObject[] fp.toArray(dictionary); // $ExpectType AbcObject[] fp.toArray(numericDictionary); // $ExpectType AbcObject[] } // _.toPlainObject { _.toPlainObject(); // $ExpectType any _.toPlainObject(true); // $ExpectType any _.toPlainObject(1); // $ExpectType any _.toPlainObject("a"); // $ExpectType any _.toPlainObject([]); // $ExpectType any _.toPlainObject({}); // $ExpectType any _(true).toPlainObject(); // $ExpectType LoDashImplicitWrapper _([""]).toPlainObject(); // $ExpectType LoDashImplicitWrapper _({}).toPlainObject(); // $ExpectType LoDashImplicitWrapper _.chain(true).toPlainObject(); // $ExpectType LoDashExplicitWrapper _.chain([""]).toPlainObject(); // $ExpectType LoDashExplicitWrapper _.chain({}).toPlainObject(); // $ExpectType LoDashExplicitWrapper fp.toPlainObject(true); // $ExpectType any fp.toPlainObject(["a"]); // $ExpectType any fp.toPlainObject({}); // $ExpectType any } // _.toFinite { _.toFinite(true); // $ExpectType number _.toFinite(1); // $ExpectType number _.toFinite("3.2"); // $ExpectType number _(1).toFinite(); // $ExpectType number _("3.2").toFinite(); // $ExpectType number _.chain(1).toFinite(); // $ExpectType LoDashExplicitWrapper _.chain("3.2").toFinite(); // $ExpectType LoDashExplicitWrapper fp.toFinite(true); // $ExpectType number fp.toFinite(1); // $ExpectType number fp.toFinite("3.2"); // $ExpectType number } // _.toInteger { _.toInteger(true); // $ExpectType number _.toInteger(1); // $ExpectType number _.toInteger("3.2"); // $ExpectType number _(1).toInteger(); // $ExpectType number _("3.2").toInteger(); // $ExpectType number _.chain(1).toInteger(); // $ExpectType LoDashExplicitWrapper _.chain("3.2").toInteger(); // $ExpectType LoDashExplicitWrapper fp.toInteger(true); // $ExpectType number fp.toInteger(1); // $ExpectType number fp.toInteger("3.2"); // $ExpectType number } // _.toLength { _.toLength(true); // $ExpectType number _.toLength(1); // $ExpectType number _.toLength("3.2"); // $ExpectType number _(1).toLength(); // $ExpectType number _("3.2").toLength(); // $ExpectType number _.chain(1).toLength(); // $ExpectType LoDashExplicitWrapper _.chain("3.2").toLength(); // $ExpectType LoDashExplicitWrapper fp.toLength(true); // $ExpectType number fp.toLength(1); // $ExpectType number fp.toLength("3.2"); // $ExpectType number } // _.toNumber { _.toNumber(true); // $ExpectType number _.toNumber(1); // $ExpectType number _.toNumber("3.2"); // $ExpectType number _(1).toNumber(); // $ExpectType number _("3.2").toNumber(); // $ExpectType number _.chain(1).toNumber(); // $ExpectType LoDashExplicitWrapper _.chain("3.2").toNumber(); // $ExpectType LoDashExplicitWrapper fp.toNumber(true); // $ExpectType number fp.toNumber(1); // $ExpectType number fp.toNumber("3.2"); // $ExpectType number } // _.toSafeInteger { _.toSafeInteger(true); // $ExpectType number _.toSafeInteger(1); // $ExpectType number _.toSafeInteger("3.2"); // $ExpectType number _(1).toSafeInteger(); // $ExpectType number _("3.2").toSafeInteger(); // $ExpectType number _.chain(1).toSafeInteger(); // $ExpectType LoDashExplicitWrapper _.chain("3.2").toSafeInteger(); // $ExpectType LoDashExplicitWrapper fp.toSafeInteger(true); // $ExpectType number fp.toSafeInteger(1); // $ExpectType number fp.toSafeInteger("3.2"); // $ExpectType number } /******** * Math * ********/ // _.add { _.add(1, 1); // $ExpectType number _(1).add(1); // $ExpectType number _(1).chain().add(1); // $ExpectType LoDashExplicitWrapper fp.add(1, 1); // $ExpectType number fp.add(1)(1); // $ExpectType number } // _.ceil { _.ceil(6.004); // $ExpectType number _.ceil(6.004, 2); // $ExpectType number _(6.004).ceil(); // $ExpectType number _(6.004).ceil(2); // $ExpectType number _(6.004).chain().ceil(); // $ExpectType LoDashExplicitWrapper _(6.004).chain().ceil(2); // $ExpectType LoDashExplicitWrapper fp.ceil(6.004); // $ExpectType number } // _.divide { _.divide(6, 4); // $ExpectType number _(6).divide(4); // $ExpectType number _(6).chain().floor(4); // $ExpectType LoDashExplicitWrapper fp.divide(6, 4); // $ExpectType number fp.divide(6)(4); // $ExpectType number } // _.floor { _.floor(4.006); // $ExpectType number _.floor(0.046, 2); // $ExpectType number _.floor(4060, -2); // $ExpectType number _(4.006).floor(); // $ExpectType number _(0.046).floor(2); // $ExpectType number _(4060).floor(-2); // $ExpectType number _(4.006).chain().floor(); // $ExpectType LoDashExplicitWrapper _(0.046).chain().floor(2); // $ExpectType LoDashExplicitWrapper _(4060).chain().floor(-2); // $ExpectType LoDashExplicitWrapper fp.floor(4.006); // $ExpectType number } // _.max // _.min { const list: ArrayLike = anything; _.max(list); // $ExpectType string | undefined _(list).max(); // $ExpectType string | undefined _.chain(list).max(); // $ExpectType LoDashExplicitWrapper fp.max(list); // $ExpectType string | undefined _.min(list); // $ExpectType string | undefined _(list).min(); // $ExpectType string | undefined _.chain(list).min(); // $ExpectType LoDashExplicitWrapper fp.min(list); // $ExpectType string | undefined } // _.maxBy // _.minBy { const list: ArrayLike = anything; _.maxBy(list, valueIterator); // $ExpectType AbcObject | undefined _.maxBy(list, "a"); // $ExpectType AbcObject | undefined _.maxBy(list, { a: 42 }); // $ExpectType AbcObject | undefined _(list).maxBy(valueIterator); // $ExpectType AbcObject | undefined _(list).maxBy("a"); // $ExpectType AbcObject | undefined _(list).maxBy({ a: 42 }); // $ExpectType AbcObject | undefined _.chain(list).maxBy(valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).maxBy("a"); // $ExpectType LoDashExplicitWrapper _.chain(list).maxBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.maxBy(valueIterator)(list); // $ExpectType AbcObject | undefined fp.maxBy("a", list); // $ExpectType AbcObject | undefined fp.maxBy({ a: 42 }, list); // $ExpectType AbcObject | undefined _.minBy(list, valueIterator); // $ExpectType AbcObject | undefined _.minBy(list, "a"); // $ExpectType AbcObject | undefined _.minBy(list, { a: 42 }); // $ExpectType AbcObject | undefined _(list).minBy(valueIterator); // $ExpectType AbcObject | undefined _(list).minBy("a"); // $ExpectType AbcObject | undefined _(list).minBy({ a: 42 }); // $ExpectType AbcObject | undefined _.chain(list).minBy(valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).minBy("a"); // $ExpectType LoDashExplicitWrapper _.chain(list).minBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper fp.minBy(valueIterator)(list); // $ExpectType AbcObject | undefined fp.minBy("a", list); // $ExpectType AbcObject | undefined fp.minBy({ a: 42 }, list); // $ExpectType AbcObject | undefined } // _.mean { const list: ArrayLike = anything; _.mean(list); // $ExpectType number _(list).mean(); // $ExpectType number _.chain(list).mean(); // $ExpectType LoDashExplicitWrapper fp.mean(list); // $ExpectType number } // _.meanBy { const list: ArrayLike = anything; _.meanBy(list, (x) => x.a); // $ExpectType number _.meanBy(list, "a"); // $ExpectType number _(list).meanBy((x) => x.a); // $ExpectType number _.chain(list).meanBy((x) => x.a); // $ExpectType LoDashExplicitWrapper fp.meanBy((x) => x.a, list); // $ExpectType number fp.meanBy((x: AbcObject) => x.a)(list); // $ExpectType number fp.meanBy("a", list); // $ExpectType number } // _.multiply { _.multiply(6, 4); // $ExpectType number _(6).multiply(4); // $ExpectType number _(6).chain().multiply(4); // $ExpectType LoDashExplicitWrapper fp.multiply(6, 4); // $ExpectType number fp.multiply(6)(4); // $ExpectType number } // _.round { _.round(4.006); // $ExpectType number _.round(4.006, 2); // $ExpectType number _(4.006).round(); // $ExpectType number _(4.006).round(2); // $ExpectType number _(4.006).chain().round(); // $ExpectType LoDashExplicitWrapper _(4.006).chain().round(2); // $ExpectType LoDashExplicitWrapper fp.round(4.006); // $ExpectType number } // _.subtract { _.subtract(3, 2); // $ExpectType number _(3).subtract(2); // $ExpectType number _(3).chain().subtract(2); // $ExpectType LoDashExplicitWrapper fp.subtract(3, 2); // $ExpectType number fp.subtract(3)(2); // $ExpectType number } // _.sum { const list: ArrayLike | null | undefined = anything; _.sum(list); // $ExpectType number _(list).sum(); // $ExpectType number _(list).chain().sum(); // $ExpectType LoDashExplicitWrapper fp.sum(list); // $ExpectType number } // _.sumBy { const listIterator = (value: AbcObject) => 0; _.sumBy(list, listIterator); // $ExpectType number _.sumBy(list, "a"); // $ExpectType number _(list).sumBy(listIterator); // $ExpectType number _(list).sumBy("a"); // $ExpectType number _(list).chain().sumBy(listIterator); // $ExpectType LoDashExplicitWrapper _(list).chain().sumBy("a"); // $ExpectType LoDashExplicitWrapper fp.sumBy(listIterator, list); // $ExpectType number fp.sumBy("a")(list); // $ExpectType number } /********** * Number * **********/ // _.clamp { _.clamp(3, 2, 4); // $ExpectType number _.clamp(3, 4); // $ExpectType number _(3).clamp(2, 4); // $ExpectType number _(3).clamp(4); // $ExpectType number _.chain(3).clamp(2, 4); // $ExpectType LoDashExplicitWrapper fp.clamp(2, 4, 3); // $ExpectType number fp.clamp(2)(4)(3); // $ExpectType number } // _.inRange { _.inRange(3, 2, 4); // $ExpectType boolean _.inRange(4, 8); // $ExpectType boolean _(3).inRange(2, 4); // $ExpectType boolean _(4).inRange(8); // $ExpectType boolean _.chain(3).inRange(2, 4); // $ExpectType LoDashExplicitWrapper _.chain(4).inRange(8); // $ExpectType LoDashExplicitWrapper fp.inRange(2, 4, 3); // $ExpectType boolean fp.inRange(2)(4)(3); // $ExpectType boolean } // _.random { _.random(); // $ExpectType number _.random(1); // $ExpectType number _.random(1, 2); // $ExpectType number _.random(1, 2, true); // $ExpectType number _.random(1, true); // $ExpectType number _.random(true); // $ExpectType number _(1).random(); // $ExpectType number _(1).random(2); // $ExpectType number _(1).random(2, true); // $ExpectType number _(1).random(true); // $ExpectType number _(true).random(); // $ExpectType number _.chain(1).random(); // $ExpectType LoDashExplicitWrapper _.chain(1).random(2); // $ExpectType LoDashExplicitWrapper _.chain(1).random(2, true); // $ExpectType LoDashExplicitWrapper _.chain(1).random(true); // $ExpectType LoDashExplicitWrapper _.chain(true).random(); // $ExpectType LoDashExplicitWrapper fp.random(1, 2); // $ExpectType number fp.random(1)(2); // $ExpectType number _.map([5, 5], _.random); // $ExpectType number[] } /********** * Object * **********/ // _.assign // _.assignIn // _.assignWith // _.assignInWith // _.defaults // _.extend // _.extendWith // _.merge // _.mergeWith { const obj = { a: "" }; const s1 = { b: 1 }; const s2 = { c: 1 }; const s3 = { d: 1 }; const s4 = { e: 1 }; const s5 = { f: 1 }; const customizer = (objectValue: any, sourceValue: any, key: string | undefined, object: {} | undefined, source: {} | undefined) => 1; _.assign(obj); // $ExpectType { a: string; } _.assign(obj, s1); // $ExpectType { a: string; } & { b: number; } _.assign(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.assign(obj, s1, s2, s3, s4, s5); _(obj).assign(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(obj).assign(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).assign(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).assign(s1, s2, s3, s4, s5); _.chain(obj).assign(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> _.chain(obj).assign(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).assign(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).assign(s1, s2, s3, s4, s5); fp.assign(obj, s1); // $ExpectType { a: string; } & { b: number; } fp.assign(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.assignIn(obj); // $ExpectType { a: string; } _.assignIn(obj, s1); // $ExpectType { a: string; } & { b: number; } _.assignIn(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.assignIn(obj, s1, s2, s3, s4, s5); _(obj).assignIn(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(obj).assignIn(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).assignIn(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).assignIn(s1, s2, s3, s4, s5); _.chain(obj).assignIn(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> _.chain(obj).assignIn(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).assignIn(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).assignIn(s1, s2, s3, s4, s5); fp.assignIn(obj, s1); // $ExpectType { a: string; } & { b: number; } fp.assignIn(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.assignWith(obj); // $ExpectType { a: string; } _.assignWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } _.assignWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.assignWith(obj, s1, s2, s3, s4, s5, customizer); _(obj).assignWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(obj).assignWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).assignWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).assignWith(s1, s2, s3, s4, s5, customizer); _.chain(obj).assignWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> _.chain(obj).assignWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).assignWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).assignWith(s1, s2, s3, s4, s5, customizer); fp.assignWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } fp.assignWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.assignInWith(obj); // $ExpectType { a: string; } _.assignInWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } _.assignInWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.assignInWith(obj, s1, s2, s3, s4, s5, customizer); _(obj).assignInWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(obj).assignInWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).assignInWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).assignInWith(s1, s2, s3, s4, s5, customizer); _.chain(obj).assignInWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> _.chain(obj).assignInWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).assignInWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).assignInWith(s1, s2, s3, s4, s5, customizer); fp.assignInWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } fp.assignInWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.defaults(obj); // $ExpectType { a: string; } _.defaults(obj, s1); // $ExpectType { b: number; } & { a: string; } _.defaults(obj, s1, s2, s3, s4); // $ExpectType { e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; } _.defaults(obj, s1, s2, s3, s4, s5); _(obj).defaults(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(obj).defaults(s1); // $ExpectType LoDashImplicitWrapper<{ b: number; } & { a: string; }> _(obj).defaults(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; }> _(obj).defaults(s1, s2, s3, s4, s5); _.chain(obj).defaults(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> _.chain(obj).defaults(s1); // $ExpectType LoDashExplicitWrapper<{ b: number; } & { a: string; }> _.chain(obj).defaults(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; }> _.chain(obj).defaults(s1, s2, s3, s4, s5); fp.defaults(obj, s1); // $ExpectType { a: string; } & { b: number; } fp.defaults(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.extend(obj); // $ExpectType { a: string; } _.extend(obj, s1); // $ExpectType { a: string; } & { b: number; } _.extend(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.extend(obj, s1, s2, s3, s4, s5); _(obj).extend(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(obj).extend(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).extend(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).extend(s1, s2, s3, s4, s5); _.chain(obj).extend(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> _.chain(obj).extend(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).extend(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).extend(s1, s2, s3, s4, s5); fp.extend(obj, s1); // $ExpectType { a: string; } & { b: number; } fp.extend(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.extendWith(obj); // $ExpectType { a: string; } _.extendWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } _.extendWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.extendWith(obj, s1, s2, s3, s4, s5, customizer); _(obj).extendWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(obj).extendWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).extendWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).extendWith(s1, s2, s3, s4, s5, customizer); _.chain(obj).extendWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> _.chain(obj).extendWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).extendWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).extendWith(s1, s2, s3, s4, s5, customizer); fp.extendWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } fp.extendWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.merge(obj, s1); // $ExpectType { a: string; } & { b: number; } _.merge(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.merge(obj, s1, s2, s3, s4, s5); _(obj).merge(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).merge(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).merge(s1, s2, s3, s4, s5); _.chain(obj).merge(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).merge(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).merge(s1, s2, s3, s4, s5); fp.merge(obj, s1); // $ExpectType { a: string; } & { b: number; } fp.merge(obj)(s1); // $ExpectType { a: string; } & { b: number; } _.mergeWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } _.mergeWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } _.mergeWith(obj, s1, s2, s3, s4, s5, customizer); _(obj).mergeWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> _(obj).mergeWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _(obj).mergeWith(s1, s2, s3, s4, s5, customizer); _.chain(obj).mergeWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> _.chain(obj).mergeWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> _.chain(obj).mergeWith(s1, s2, s3, s4, s5, customizer); fp.mergeWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } fp.mergeWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } } // _.create { const prototype = { a: 1 }; const properties = { b: "" }; _.create(prototype, properties); // $ExpectType { a: number; } & { b: string; } _(prototype).create(properties); // $ExpectType LoDashImplicitWrapper<{ a: number; } & { b: string; }> _.chain(prototype).create(properties); // $ExpectType LoDashExplicitWrapper<{ a: number; } & { b: string; }> const combined: { a: number } & object = fp.create(prototype); } // _.defaultsDeep { const testDefaultsDeepObject = { user: { name: "barney" } }; const testDefaultsDeepSource = { user: { name: "fred", age: 36 } }; _.defaultsDeep(testDefaultsDeepObject, testDefaultsDeepSource); // $ExpectType any _(testDefaultsDeepObject).defaultsDeep(testDefaultsDeepSource); // $ExpectType LoDashImplicitWrapper _.chain(testDefaultsDeepObject).defaultsDeep(testDefaultsDeepSource); // $ExpectType LoDashExplicitWrapper fp.defaultsDeep(testDefaultsDeepSource, testDefaultsDeepObject); // $ExpectType any fp.defaultsDeep(testDefaultsDeepSource)(testDefaultsDeepObject); // $ExpectType any } // _.entries // _.entriesIn { const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; _.entries(dictionary); // $ExpectType [string, number][] _.entries(numericDictionary); // $ExpectType [string, number][] _.entries(abcObject); // $ExpectType [string, any][] _(dictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _(numericDictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _.chain(dictionary).entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(numericDictionary).entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(abcObject).entries(); // $ExpectType LoDashExplicitWrapper<[string, any][]> fp.entries(dictionary); // $ExpectType [string, number][] _.entriesIn(dictionary); // $ExpectType [string, number][] _.entriesIn(numericDictionary); // $ExpectType [string, number][] _.entriesIn(abcObject); // $ExpectType [string, any][] _(dictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _(numericDictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _.chain(dictionary).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(numericDictionary).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(abcObject).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> fp.entriesIn(dictionary); // $ExpectType [string, number][] } // _.findKey // _.findLastKey { const predicateFn = (value: string, key: string, object: { a: string }) => true; const predicateFn2 = (value: number) => true; _.findKey({ a: "" }); // $ExpectType string | undefined _.findKey({ a: "" }, predicateFn); // $ExpectType string | undefined _.findKey({ a: "" }, ""); // $ExpectType string | undefined _.findKey({ a: { b: 5 } }, { b: 42 }); // $ExpectType string | undefined _.findKey({ a: { b: 5 } }, ["b", 5]); // $ExpectType string | undefined _({ a: "" }).findKey(); // $ExpectType string | undefined _({ a: "" }).findKey(predicateFn); // $ExpectType string | undefined _({ a: "" }).findKey(""); // $ExpectType string | undefined _({ a: { b: 5 } }).findKey({ b: 42 }); // $ExpectType string | undefined _({ a: { b: 5 } }).findKey(["b", 5]); // $ExpectType string | undefined _.chain({ a: "" }).findKey(); // $ExpectType LoDashExplicitWrapper _.chain({ a: "" }).findKey(predicateFn); // $ExpectType LoDashExplicitWrapper _.chain({ a: "" }).findKey(""); // $ExpectType LoDashExplicitWrapper _.chain({ a: { b: 5 } }).findKey({ b: 42 }); // $ExpectType LoDashExplicitWrapper _.chain({ a: { b: 5 } }).findKey(["b", 5]); // $ExpectType LoDashExplicitWrapper fp.findKey(predicateFn2, { a: 1 }); // $ExpectType string | undefined fp.findKey(predicateFn2)({ a: 1 }); // $ExpectType string | undefined _.findLastKey({ a: "" }); // $ExpectType string | undefined _.findLastKey({ a: "" }, predicateFn); // $ExpectType string | undefined _.findLastKey({ a: "" }, ""); // $ExpectType string | undefined _.findLastKey({ a: { b: 5 } }, { b: 42 }); // $ExpectType string | undefined _.findLastKey({ a: { b: 5 } }, ["b", 5]); // $ExpectType string | undefined _({ a: "" }).findLastKey(); // $ExpectType string | undefined _({ a: "" }).findLastKey(predicateFn); // $ExpectType string | undefined _({ a: "" }).findLastKey(""); // $ExpectType string | undefined _({ a: { b: 5 } }).findLastKey({ b: 42 }); // $ExpectType string | undefined _({ a: { b: 5 } }).findLastKey(["b", 5]); // $ExpectType string | undefined _.chain({ a: "" }).findLastKey(); // $ExpectType LoDashExplicitWrapper _.chain({ a: "" }).findLastKey(predicateFn); // $ExpectType LoDashExplicitWrapper _.chain({ a: "" }).findLastKey(""); // $ExpectType LoDashExplicitWrapper _.chain({ a: { b: 5 } }).findLastKey({ b: 42 }); // $ExpectType LoDashExplicitWrapper _.chain({ a: { b: 5 } }).findLastKey(["b", 5]); // $ExpectType LoDashExplicitWrapper fp.findLastKey(predicateFn2, { a: 1 }); // $ExpectType string | undefined fp.findLastKey(predicateFn2)({ a: 1 }); // $ExpectType string | undefined } // _.forIn // _.forInRight // _.forOwn // _.forOwnRight { const dictionary: _.Dictionary = {}; const dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => {}; const dictionaryIterator2 = (value: number) => {}; const object: AbcObject | null | undefined = anything; const objectIterator = (element: string | number | boolean, key: string, collection: AbcObject) => {}; const objectIterator2 = (element: number | string | boolean) => {}; _.forIn(dictionary); // $ExpectType Dictionary _.forIn(dictionary, dictionaryIterator); // $ExpectType Dictionary _.forIn(object); // $ExpectType AbcObject | null | undefined _.forIn(object, objectIterator); // $ExpectType AbcObject | null | undefined _(object).forIn(); // $ExpectType LoDashImplicitWrapper _(object).forIn(objectIterator); // $ExpectType LoDashImplicitWrapper _.chain(object).forIn(); // $ExpectType LoDashExplicitWrapper _.chain(object).forIn(objectIterator); // $ExpectType LoDashExplicitWrapper fp.forIn(dictionaryIterator2, dictionary); // $ExpectType Dictionary fp.forIn(objectIterator2)(object); // $ExpectType AbcObject | null | undefined _.forInRight(dictionary); // $ExpectType Dictionary _.forInRight(dictionary, dictionaryIterator); // $ExpectType Dictionary _.forInRight(object); // $ExpectType AbcObject | null | undefined _.forInRight(object, objectIterator); // $ExpectType AbcObject | null | undefined _(object).forInRight(); // $ExpectType LoDashImplicitWrapper _(object).forInRight(objectIterator); // $ExpectType LoDashImplicitWrapper _.chain(object).forInRight(); // $ExpectType LoDashExplicitWrapper _.chain(object).forInRight(objectIterator); // $ExpectType LoDashExplicitWrapper fp.forInRight(dictionaryIterator2, dictionary); // $ExpectType Dictionary fp.forInRight(objectIterator2)(object); // $ExpectType AbcObject | null | undefined _.forOwn(dictionary); // $ExpectType Dictionary _.forOwn(dictionary, dictionaryIterator); // $ExpectType Dictionary _.forOwn(object); // $ExpectType AbcObject | null | undefined _.forOwn(object, objectIterator); // $ExpectType AbcObject | null | undefined _(object).forOwn(); // $ExpectType LoDashImplicitWrapper _(object).forOwn(objectIterator); // $ExpectType LoDashImplicitWrapper _.chain(object).forOwn(); // $ExpectType LoDashExplicitWrapper _.chain(object).forOwn(objectIterator); // $ExpectType LoDashExplicitWrapper fp.forOwn(dictionaryIterator2, dictionary); // $ExpectType Dictionary fp.forOwn(objectIterator2)(object); // $ExpectType AbcObject | null | undefined _.forOwnRight(dictionary); // $ExpectType Dictionary _.forOwnRight(dictionary, dictionaryIterator); // $ExpectType Dictionary _.forOwnRight(object); // $ExpectType AbcObject | null | undefined _.forOwnRight(object, objectIterator); // $ExpectType AbcObject | null | undefined _(object).forOwnRight(); // $ExpectType LoDashImplicitWrapper _(object).forOwnRight(objectIterator); // $ExpectType LoDashImplicitWrapper _.chain(object).forOwnRight(); // $ExpectType LoDashExplicitWrapper _.chain(object).forOwnRight(objectIterator); // $ExpectType LoDashExplicitWrapper fp.forOwnRight(dictionaryIterator2, dictionary); // $ExpectType Dictionary fp.forOwnRight(objectIterator2)(object); // $ExpectType AbcObject | null | undefined } // _.functions // _.functionsIn { _.functions(abcObject); // $ExpectType string[] _(abcObject).functions(); // $ExpectType LoDashImplicitWrapper _.chain(abcObject).functions(); // $ExpectType LoDashExplicitWrapper fp.functions(abcObject); // $ExpectType string[] _.functionsIn(abcObject); // $ExpectType string[] _(abcObject).functionsIn(); // $ExpectType LoDashImplicitWrapper _.chain(abcObject).functionsIn(); // $ExpectType LoDashExplicitWrapper fp.functionsIn(abcObject); // $ExpectType string[] } // _.get { const value: string | undefined = anything; const defaultValue: boolean = anything; _.get([], Symbol.iterator); _.get([], [Symbol.iterator]); _.get("abc", 1); // $ExpectType string _.get("abc", ["0"], "_"); _.get([42], 0, -1); // $ExpectType number _.get({ a: { b: true } }, "a"); // $ExpectType { b: boolean; } _.get({ a: { b: true } }, ["a"]); // $ExpectType { b: boolean; } _.get({ a: { b: true } }, ["a", "b"]); // $ExpectType boolean | undefined _.get({ a: { b: { c: { d: true} } } }, ["a", "b", "c", "d"]); // $ExpectType boolean | undefined _.get({ a: undefined }, "a"); // $ExpectType undefined _.get({ a: value }, "a", defaultValue); // $ExpectType string | boolean _.get({ a: undefined }, "a", defaultValue); // $ExpectType boolean _("abc").get(1); // $ExpectType string _("abc").get(["0"], "_"); _([42]).get(0, -1); // $ExpectType number _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } _({ a: { b: true } }).get(["a"]); // $ExpectType { b: boolean; } _({ a: { b: true } }).get(["a", "b"]); // $ExpectType boolean _({ a: { b: { c: { d: true}} } }).get(["a", "b", "c", "d"]); // $ExpectType boolean _({ a: undefined }).get("a"); // $ExpectType undefined _({ a: value }).get("a", defaultValue); // $ExpectType string | boolean _({ a: undefined }).get("a", defaultValue); // $ExpectType boolean _.chain("abc").get(1); // $ExpectType LoDashExplicitWrapper _.chain("abc").get(["0"], "_"); _.chain([42]).get(0, -1); // ExpectType LoDashExplicitWrapper _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper _.chain({ a: { b: { c: { d: true}} } }).get(["a", "b", "c", "d"]); // $ExpectType LoDashExplicitWrapper _.chain({ a: undefined }).get("a"); // $ExpectType LoDashExplicitWrapper _.chain({ a: value }).get("a", defaultValue); // $ExpectType LoDashExplicitWrapper _.chain({ a: undefined }).get("a", defaultValue); // $ExpectType LoDashExplicitWrapper fp.get(Symbol.iterator, []); // $ExpectType any fp.get(Symbol.iterator)([]); // $ExpectType any fp.get([Symbol.iterator], []); // $ExpectType any fp.get(1)("abc"); // $ExpectType string fp.get("1")("abc"); // $ExpectType any fp.get("a", { a: { b: true } }); // $ExpectType { b: boolean; } fp.get<{ a: { b: boolean } }, "a">("a")({ a: { b: true } }); // $ExpectType { b: boolean; } fp.get(["a", "b"])({ a: { b: true } }); // $ExpectType any fp.get(0)([42]); // $ExpectType number fp.getOr(-1, 0, [42]); // $ExpectType number fp.getOr(-1)(0)([42]); // $ExpectType number fp.getOr("empty" as "empty")(0)([42]); // $ExpectType number | "empty" } // _.has // _.hasIn { _.has(abcObject, ""); // $ExpectType boolean _.has(abcObject, 42); // $ExpectType boolean _.has(abcObject, ["", 42]); // $ExpectType boolean _(abcObject).has(""); // $ExpectType boolean _(abcObject).has(42); // $ExpectType boolean _(abcObject).has(["", 42]); // $ExpectType boolean _.chain(abcObject).has(""); // $ExpectType LoDashExplicitWrapper _.chain(abcObject).has(42); // $ExpectType LoDashExplicitWrapper _.chain(abcObject).has(["", 42]); // $ExpectType LoDashExplicitWrapper fp.has("a", abcObject); // $ExpectType boolean fp.has("a")(abcObject); // $ExpectType boolean fp.has(["a", 42])(abcObject); // $ExpectType boolean _.hasIn(abcObject, ""); // $ExpectType boolean _.hasIn(abcObject, 42); // $ExpectType boolean _.hasIn(abcObject, ["", 42]); // $ExpectType boolean _(abcObject).hasIn(""); // $ExpectType boolean _(abcObject).hasIn(42); // $ExpectType boolean _(abcObject).hasIn(["", 42]); // $ExpectType boolean _.chain(abcObject).hasIn(""); // $ExpectType LoDashExplicitWrapper _.chain(abcObject).hasIn(42); // $ExpectType LoDashExplicitWrapper _.chain(abcObject).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper fp.hasIn("a", abcObject); // $ExpectType boolean fp.hasIn("a")(abcObject); // $ExpectType boolean fp.hasIn(["a", 42])(abcObject); // $ExpectType boolean } // _.invert { _.invert({}); // $ExpectType Dictionary _({}).invert(); // $ExpectType LoDashImplicitWrapper> _.chain({}).invert(); // $ExpectType LoDashExplicitWrapper> fp.invert({}); // $ExpectType Dictionary } // _.invertBy { const list: ArrayLike<{ a: number }> = anything; const dictionary: _.Dictionary<{ a: number }> = {}; const numericDictionary: _.NumericDictionary<{ a: number }> = {}; const valueIterator = (value: {a: number }) => 1; _.invertBy("foo"); // $ExpectType Dictionary _.invertBy("foo", stringIterator); // $ExpectType Dictionary _.invertBy(list); // $ExpectType Dictionary _.invertBy(list, "a"); // $ExpectType Dictionary _.invertBy(list, valueIterator); // $ExpectType Dictionary _.invertBy(list, {a: 1}); // $ExpectType Dictionary _.invertBy(dictionary); // $ExpectType Dictionary _.invertBy(dictionary, "a"); // $ExpectType Dictionary _.invertBy(dictionary, valueIterator); // $ExpectType Dictionary _.invertBy(dictionary, {a: 1}); // $ExpectType Dictionary _.invertBy(numericDictionary); // $ExpectType Dictionary _.invertBy(numericDictionary, "a"); // $ExpectType Dictionary _.invertBy(numericDictionary, valueIterator); // $ExpectType Dictionary _.invertBy(numericDictionary, {a: 1}); // $ExpectType Dictionary _("foo").invertBy(stringIterator); // $ExpectType LoDashImplicitWrapper> _(list).invertBy(); // $ExpectType LoDashImplicitWrapper> _(list).invertBy("a"); // $ExpectType LoDashImplicitWrapper> _(dictionary).invertBy(valueIterator); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).invertBy({a: 1}); // $ExpectType LoDashImplicitWrapper> _.chain("foo").invertBy(stringIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).invertBy(); // $ExpectType LoDashExplicitWrapper> _.chain(list).invertBy("a"); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).invertBy(valueIterator); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).invertBy({a: 1}); // $ExpectType LoDashExplicitWrapper> fp.invertBy(stringIterator, "foo"); // $ExpectType Dictionary fp.invertBy(stringIterator)("foo"); // $ExpectType Dictionary fp.invertBy(valueIterator)(list); // $ExpectType Dictionary fp.invertBy("a")(list); // $ExpectType Dictionary fp.invertBy({ a: 1 })(list); // $ExpectType Dictionary fp.invertBy(valueIterator)(dictionary); // $ExpectType Dictionary fp.invertBy("a")(dictionary); // $ExpectType Dictionary fp.invertBy({ a: 1 })(dictionary); // $ExpectType Dictionary fp.invertBy(valueIterator)(numericDictionary); // $ExpectType Dictionary fp.invertBy("a")(numericDictionary); // $ExpectType Dictionary fp.invertBy({ a: 1 })(numericDictionary); // $ExpectType Dictionary } // _.keys // _.keysIn { const object: AbcObject | null | undefined = anything; _.keys(object); // $ExpectType string[] _(object).keys(); // $ExpectType LoDashImplicitWrapper _.chain(object).keys(); // $ExpectType LoDashExplicitWrapper fp.keys({}); // $ExpectType string[] _.keysIn(object); // $ExpectType string[] _(object).keysIn(); // $ExpectType LoDashImplicitWrapper _.chain(object).keysIn(); // $ExpectType LoDashExplicitWrapper fp.keysIn({}); // $ExpectType string[] } // _.mapKeys { const abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; _.mapKeys(list); // $ExpectType Dictionary _.mapKeys(list, listIterator); // $ExpectType Dictionary _.mapKeys(list, ""); // $ExpectType Dictionary _.mapKeys(list, {}); // $ExpectType Dictionary _.mapKeys(dictionary); // $ExpectType Dictionary _.mapKeys(dictionary, dictionaryIterator); // $ExpectType Dictionary _.mapKeys(dictionary, ""); // $ExpectType Dictionary _.mapKeys(dictionary, {}); // $ExpectType Dictionary _.mapKeys(numericDictionary); // $ExpectType Dictionary _.mapKeys(numericDictionary, numericDictionaryIterator); // $ExpectType Dictionary _.mapKeys(numericDictionary, ""); // $ExpectType Dictionary _.mapKeys(numericDictionary, {}); // $ExpectType Dictionary _.mapKeys(abcObject); // $ExpectType Dictionary _.mapKeys(abcObject, abcObjectIterator); // $ExpectType Dictionary _.mapKeys(abcObject, ""); // $ExpectType Dictionary _(list).mapKeys(); // $ExpectType LoDashImplicitWrapper> _(list).mapKeys(listIterator); // $ExpectType LoDashImplicitWrapper> _(list).mapKeys(""); // $ExpectType LoDashImplicitWrapper> _(list).mapKeys({}); // $ExpectType LoDashImplicitWrapper> _(dictionary).mapKeys(); // $ExpectType LoDashImplicitWrapper> _(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> _(dictionary).mapKeys(""); // $ExpectType LoDashImplicitWrapper> _(dictionary).mapKeys({}); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).mapKeys(); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).mapKeys(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).mapKeys(""); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).mapKeys({}); // $ExpectType LoDashImplicitWrapper> _(abcObject).mapKeys(); // $ExpectType LoDashImplicitWrapper> _(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashImplicitWrapper> _(abcObject).mapKeys(""); // $ExpectType LoDashImplicitWrapper> _.chain(list).mapKeys(); // $ExpectType LoDashExplicitWrapper> _.chain(list).mapKeys(listIterator); // $ExpectType LoDashExplicitWrapper> _.chain(list).mapKeys(""); // $ExpectType LoDashExplicitWrapper> _.chain(list).mapKeys({}); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).mapKeys(); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).mapKeys(""); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).mapKeys({}); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).mapKeys(); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).mapKeys(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).mapKeys(""); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).mapKeys({}); // $ExpectType LoDashExplicitWrapper> _.chain(abcObject).mapKeys(); // $ExpectType LoDashExplicitWrapper> _.chain(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashExplicitWrapper> _.chain(abcObject).mapKeys(""); // $ExpectType LoDashExplicitWrapper> const indexIterator = (index: number) => index + 1; const keyIterator = (key: string) => "_" + key; fp.mapKeys(indexIterator, list); // $ExpectType Dictionary fp.mapKeys(keyIterator)(dictionary); // $ExpectType Dictionary fp.mapKeys(keyIterator)(abcObject); // $ExpectType Dictionary } // _.mapValues { const abcObjectOrNull: AbcObject | null = anything; const key: string = anything; // $ExpectType NumericDictionary _.mapValues("foo", (char, index, str) => { char; // $ExpectType string index; // $ExpectType number str; // $ExpectType string return abcObject; }); // $ExpectType Dictionary _.mapValues(dictionary, (value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return ""; }); // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary // $ExpectType Dictionary _.mapValues(numericDictionary, (value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return ""; }); // $ExpectType { a: string; b: string; c: string; } _.mapValues(abcObject, (value, key, collection) => { value; // $ExpectType string | number | boolean key; // $ExpectType string collection; // $ExpectType AbcObject return ""; }); _.mapValues(dictionary, {}); // $ExpectType Dictionary // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.mapValues(numericDictionary, {}); // $ExpectType Dictionary _.mapValues(abcObject, {}); // $ExpectType { a: boolean; b: boolean; c: boolean; } _.mapValues(dictionary, "a"); // $ExpectType Dictionary // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.mapValues(numericDictionary, "a"); // $ExpectType Dictionary _.mapValues(abcObject, key); // $ExpectType { a: any; b: any; c: any; } _.mapValues(dictionary, key); // $ExpectType Dictionary // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.mapValues(numericDictionary, key); // $ExpectType Dictionary _.mapValues("a"); // $ExpectType NumericDictionary _.mapValues(dictionary); // $ExpectType Dictionary // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.mapValues(numericDictionary); // $ExpectType Dictionary _.mapValues(abcObject); // $ExpectType AbcObject _.mapValues(abcObjectOrNull); // $ExpectType Partial // $ExpectType LoDashImplicitWrapper> _("foo").mapValues((char, index, str) => { char; // $ExpectType string index; // $ExpectType number str; // $ExpectType string return abcObject; }); // $ExpectType LoDashImplicitWrapper> _(dictionary).mapValues((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return ""; }); // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary // $ExpectType LoDashImplicitWrapper> _(numericDictionary).mapValues((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return ""; }); // $ExpectType LoDashImplicitWrapper<{ a: string; b: string; c: string; }> _(abcObject).mapValues((value, key, collection) => { value; // $ExpectType string | number | boolean key; // $ExpectType string collection; // $ExpectType AbcObject return ""; }); _(dictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _(numericDictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> _(abcObject).mapValues({}); // $ExpectType LoDashImplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> _(dictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _(numericDictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> _(abcObject).mapValues(key); // $ExpectType LoDashImplicitWrapper<{ a: any; b: any; c: any; }> _(dictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _(numericDictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> _("a").mapValues(); // $ExpectType LoDashImplicitWrapper> _(dictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _(numericDictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> _(abcObject).mapValues(); // $ExpectType LoDashImplicitWrapper _(abcObjectOrNull).mapValues(); // $ExpectType LoDashImplicitWrapper> // $ExpectType LoDashExplicitWrapper> _.chain("foo").mapValues((char, index, str) => { char; // $ExpectType string index; // $ExpectType number str; // $ExpectType string return abcObject; }); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).mapValues((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return ""; }); // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).mapValues((value, key, collection) => { value; // $ExpectType AbcObject key; // $ExpectType string collection; // $ExpectType Dictionary return ""; }); // $ExpectType LoDashExplicitWrapper<{ a: string; b: string; c: string; }> _.chain(abcObject).mapValues((value, key, collection) => { value; // $ExpectType string | number | boolean key; // $ExpectType string collection; // $ExpectType AbcObject return ""; }); _.chain(dictionary).mapValues({}); // $ExpectType LoDashExplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.chain(numericDictionary).mapValues({}); // $ExpectType LoDashExplicitWrapper> _.chain(abcObject).mapValues({}); // $ExpectType LoDashExplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> _.chain(dictionary).mapValues("a"); // $ExpectType LoDashExplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.chain(numericDictionary).mapValues("a"); // $ExpectType LoDashExplicitWrapper> _.chain(abcObject).mapValues(key); // $ExpectType LoDashExplicitWrapper<{ a: any; b: any; c: any; }> _.chain(dictionary).mapValues(key); // $ExpectType LoDashExplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.chain(numericDictionary).mapValues(key); // $ExpectType LoDashExplicitWrapper> _.chain("a").mapValues(); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).mapValues(); // $ExpectType LoDashExplicitWrapper> // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary _.chain(numericDictionary).mapValues(); // $ExpectType LoDashExplicitWrapper> _.chain(abcObject).mapValues(); // $ExpectType LoDashExplicitWrapper _.chain(abcObjectOrNull).mapValues(); // $ExpectType LoDashExplicitWrapper> fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary fp.mapValues("a", dictionary); // $ExpectType Dictionary fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary fp.mapValues({ a: 42 })(numericDictionary); // $ExpectType Dictionary fp.mapValues(value => "", abcObjectOrNull); // $ExpectType { a: string; b: string; c: string; } } // _.omit { const obj: AbcObject | null | undefined = anything; const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; _.omit(obj, "a"); // $ExpectType Pick _.omit(obj, ["b", 1], 0, "a"); // $ExpectType Partial _.omit(dictionary, "a"); // $ExpectType Dictionary _.omit(numericDictionary, "a"); // $ExpectType NumericDictionary _(obj).omit("a"); // $ExpectType LoDashImplicitWrapper> _(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(dictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> _.chain(obj).omit("a"); // $ExpectType LoDashExplicitWrapper> _.chain(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> fp.omit("a", obj); // $ExpectType Pick fp.omit("a")(obj); // $ExpectType Partial fp.omit(["a", "b"])(obj); // $ExpectType Partial } // _.omitBy { const obj: AbcObject | null | undefined = anything; const dictionary: _.Dictionary | null | undefined = anything; const numericDictionary: _.NumericDictionary | null | undefined = anything; const predicate = (element: string | number | boolean, key: string) => true; const predicate2 = (element: boolean, key: string) => true; _.omitBy(obj, predicate); // $ExpectType Partial _.omitBy(dictionary, predicate2); // $ExpectType Dictionary _.omitBy(numericDictionary, predicate2); // $ExpectType NumericDictionary _(obj).omitBy(predicate); // $ExpectType LoDashImplicitWrapper> _(dictionary).omitBy(predicate2); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).omitBy(predicate2); // $ExpectType LoDashImplicitWrapper> _.chain(obj).omitBy(predicate); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).omitBy(predicate2); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).omitBy(predicate2); // $ExpectType LoDashExplicitWrapper> fp.omitBy(predicate, obj); // $ExpectType Partial fp.omitBy(predicate2)(dictionary); // $ExpectType Dictionary fp.omitBy(predicate2)(numericDictionary); // $ExpectType NumericDictionary } // _.pick { const obj1: AbcObject | null | undefined = anything; const obj2: AbcObject = anything; const readonlyArray: ReadonlyArray = ["a", "b"]; const literalsArray: Array<"a" | "b"> = ["a", "b"]; const roLiteralsArray: ReadonlyArray<"a" | "b"> = literalsArray; _.pick(obj1, "a"); // $ExpectType PartialDeep _.pick(obj1, 0, "a"); // $ExpectType PartialDeep _.pick(obj1, ["b", 1], 0, "a"); // $ExpectType PartialDeep _.pick(obj1, readonlyArray); // $ExpectType PartialDeep _.pick(obj2, "a", "b"); // $ExpectType Pick // We can't use ExpectType here because typescript keeps changing what order the types appear. let result1: Pick; result1 = _.pick(obj2, literalsArray); result1 = _.pick(obj2, roLiteralsArray); _(obj1).pick("a"); // $ExpectType LoDashImplicitWrapper> _(obj1).pick(0, "a"); // $ExpectType LoDashImplicitWrapper> _(obj1).pick(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(obj1).pick(readonlyArray); // $ExpectType LoDashImplicitWrapper> _(obj2).pick("a", "b"); // $ExpectType LoDashImplicitWrapper> let result2: _.LoDashImplicitWrapper>; result2 = _(obj2).pick(literalsArray); result2 = _(obj2).pick(roLiteralsArray); _.chain(obj1).pick("a"); // $ExpectType LoDashExplicitWrapper> _.chain(obj1).pick(0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(obj1).pick(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(obj1).pick(readonlyArray); // $ExpectType LoDashExplicitWrapper> _.chain(obj2).pick("a", "b"); // $ExpectType LoDashExplicitWrapper> let result3: _.LoDashExplicitWrapper>; result3 = _.chain(obj2).pick(literalsArray); result3 = _.chain(obj2).pick(roLiteralsArray); fp.pick("a", obj2); // $ExpectType Pick fp.pick("a")(obj2); // $ExpectType Pick result1 = fp.pick(literalsArray)(obj2); } // _.pickBy { const obj: AbcObject | null | undefined = anything; const dictionary: _.Dictionary | null | undefined = anything; const numericDictionary: _.NumericDictionary | null | undefined = anything; const predicate = (element: string | number | boolean, key: string) => true; const predicate2 = (element: boolean, key: string) => true; _.pickBy(obj, predicate); // $ExpectType Partial _.pickBy(dictionary, predicate2); // $ExpectType Dictionary _.pickBy(numericDictionary, predicate2); // $ExpectType NumericDictionary _(obj).pickBy(predicate); // $ExpectType LoDashImplicitWrapper> _(dictionary).pickBy(predicate2); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).pickBy(predicate2); // $ExpectType LoDashImplicitWrapper> _.chain(obj).pickBy(predicate); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).pickBy(predicate2); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).pickBy(predicate2); // $ExpectType LoDashExplicitWrapper> fp.pickBy(predicate, obj); // $ExpectType Partial fp.pickBy(predicate2)(dictionary); // $ExpectType Dictionary fp.pickBy(predicate2)(numericDictionary); // $ExpectType NumericDictionary const mixedDictionary: _.Dictionary | null | undefined = anything; const userDefinedTypeGuard = (item: string | number): item is number => typeof item === "number"; _.pickBy(mixedDictionary, userDefinedTypeGuard); // $ExpectType Dictionary _(mixedDictionary).pickBy(userDefinedTypeGuard); // $ExpectType LoDashImplicitWrapper> _.chain(mixedDictionary).pickBy(userDefinedTypeGuard); // $ExpectType LoDashExplicitWrapper> fp.pickBy(userDefinedTypeGuard)(mixedDictionary); // $ExpectType Dictionary const mixedNumericDictionary: _.NumericDictionary | null | undefined = anything; _.pickBy(mixedNumericDictionary, userDefinedTypeGuard); // $ExpectType NumericDictionary _(mixedNumericDictionary).pickBy(userDefinedTypeGuard); // $ExpectType LoDashImplicitWrapper> _.chain(mixedNumericDictionary).pickBy(userDefinedTypeGuard); // $ExpectType LoDashExplicitWrapper> fp.pickBy(userDefinedTypeGuard)(mixedNumericDictionary); // $ExpectType NumericDictionary } // _.result { _.result("abc", "0"); // $ExpectType string _.result("abc", 0, "_"); // $ExpectType string _.result("abc", "0", () => "_"); // $ExpectType string _.result("abc", ["0"]); // $ExpectType string _.result("abc", [0], () => "_"); // $ExpectType string _.result({ a: () => true }, "a"); // $ExpectType boolean _("abc").result("0"); // $ExpectType string _("abc").result(0, "_"); // $ExpectType string _("abc").result("0", () => "_"); // $ExpectType string _("abc").result(["0"]); // $ExpectType string _("abc").result([0], () => "_"); // $ExpectType string _({ a: () => true }).result("a"); // $ExpectType boolean _.chain("abc").result("0"); // $ExpectType LoDashExplicitWrapper _.chain("abc").result(0, "_"); // $ExpectType LoDashExplicitWrapper _.chain("abc").result("0", () => "_"); // $ExpectType LoDashExplicitWrapper _.chain("abc").result(["0"]); // $ExpectType LoDashExplicitWrapper _.chain("abc").result([0], () => "_"); // $ExpectType LoDashExplicitWrapper _.chain({ a: () => true }).result("a"); // $ExpectType LoDashExplicitWrapper fp.result("0", "abc"); // $ExpectType string fp.result("0")("abc"); // $ExpectType string } // _.set // _.setWith { interface SampleResult { a: { b: number[]; }; } const object = { a: {} }; _.set(object, "a.b[1]", 42); // $ExpectType SampleResult _.set(object, ["a", "b", 1], 42); // $ExpectType SampleResult _(object).set("a.b[1]", 42); // $ExpectType LoDashImplicitWrapper _(object).set(["a", "b", 1], 42); // $ExpectType LoDashImplicitWrapper _.chain(object).set("a.b[1]", 42); // $ExpectType LoDashExplicitWrapper _.chain(object).set(["a", "b", 1], 42); // $ExpectType LoDashExplicitWrapper fp.set("a", 42, object); // $ExpectType { a: {}; } fp.set("a.b[1]")(42)(object); // $ExpectType { a: {}; } fp.set(["a", "b", 1])(42)(object); // $ExpectType { a: {}; } } { interface SampleResult { a: { b: number[]; }; } const object: SampleResult = { a: { b: [0, 1] } }; const customizer = (value: any, key: string, object: SampleResult) => 0; _.setWith(object, "a.b[1]", 42); // $ExpectType SampleResult _.setWith(object, "a.b[1]", 42, customizer); // $ExpectType SampleResult _.setWith(object, ["a", "b", 1], 42, customizer); // $ExpectType SampleResult _(object).setWith("a.b[1]", 42); // $ExpectType LoDashImplicitWrapper _(object).setWith("a.b[1]", 42, customizer); // $ExpectType LoDashImplicitWrapper _(object).setWith(["a", "b", 1], 42, customizer); // $ExpectType LoDashImplicitWrapper _.chain(object).setWith("a.b[1]", 42); // $ExpectType LoDashExplicitWrapper _.chain(object).setWith("a.b[1]", 42, customizer); // $ExpectType LoDashExplicitWrapper _.chain(object).setWith(["a", "b", 1], 42, customizer); // $ExpectType LoDashExplicitWrapper fp.setWith(customizer, "a", 42, object); // $ExpectType SampleResult fp.setWith(customizer)("a.b[1]")(42)(object); // $ExpectType SampleResult fp.setWith(customizer)(["a", "b", 1])(42)(object); // $ExpectType SampleResult } // _.toPairs // _.toPairsIn { const dictionary: _.Dictionary = {}; const numericDictionary: _.NumericDictionary = {}; _.toPairs(dictionary); // $ExpectType [string, number][] _.toPairs(numericDictionary); // $ExpectType [string, number][] _.toPairs(abcObject); // $ExpectType [string, any][] _(dictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _(numericDictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _(abcObject).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, any][]> _.chain(dictionary).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(numericDictionary).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(abcObject).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, any][]> fp.toPairs(dictionary); // $ExpectType [string, number][] _.toPairsIn(dictionary); // $ExpectType [string, number][] _.toPairsIn(numericDictionary); // $ExpectType [string, number][] _.toPairsIn(abcObject); // $ExpectType [string, any][] _(dictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _(numericDictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> _(abcObject).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, any][]> _.chain(dictionary).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(numericDictionary).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> _.chain(abcObject).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> fp.toPairsIn(dictionary); // $ExpectType [string, number][] } // _.transform { const array: number[] = []; const dictionary: _.Dictionary = {}; { const iterator = (acc: AbcObject[], curr: number, index?: number, arr?: number[]) => {}; const accumulator: AbcObject[] = []; _.transform(array); // $ExpectType any[] _.transform(array, iterator); // $ExpectType AbcObject[] _.transform(array, iterator, accumulator); // $ExpectType AbcObject[] _(array).transform(); // $ExpectType LoDashImplicitWrapper _(array).transform(iterator); // $ExpectType LoDashImplicitWrapper _(array).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper _.chain(array).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper } { const iterator = (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => {}; const accumulator: _.Dictionary = {}; _.transform(array, iterator, accumulator); // $ExpectType Dictionary _(array).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper> _.chain(array).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper> } { const iterator = (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => {}; const accumulator: _.Dictionary = {}; _.transform(dictionary); // $ExpectType Dictionary _.transform(dictionary, iterator); // $ExpectType Dictionary _.transform(dictionary, iterator, accumulator); // $ExpectType Dictionary _(dictionary).transform(); // $ExpectType LoDashImplicitWrapper> _(dictionary).transform(iterator); // $ExpectType LoDashImplicitWrapper> _(dictionary).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper> } { const iterator = (acc: AbcObject[], curr: number, key?: string, dict?: _.Dictionary) => {}; const accumulator: AbcObject[] = []; _.transform(dictionary, iterator, accumulator); // $ExpectType AbcObject[] _(dictionary).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper _.chain(dictionary).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper } { const iterator = (acc: AbcObject[], curr: number): AbcObject => anything; const accumulator: AbcObject[] = []; fp.transform(iterator, accumulator, array); // $ExpectType AbcObject[] fp.transform(iterator)(accumulator)(array); // $ExpectType AbcObject[] fp.transform(iterator)(accumulator)(dictionary); // $ExpectType AbcObject[] } { const iterator = (acc: _.Dictionary, curr: number): AbcObject => anything; const accumulator: _.Dictionary = {}; fp.transform(iterator)(accumulator)(array); // $ExpectType Dictionary fp.transform(iterator)(accumulator)(dictionary); // $ExpectType Dictionary } } // _.unset { const object = { a: { b: "", c: true } }; _.unset(object, "a.b"); // $ExpectType boolean _.unset(object, ["a", "b"]); // $ExpectType boolean _(object).unset("a.b"); // $ExpectType LoDashImplicitWrapper _(object).unset(["a", "b"]); // $ExpectType LoDashImplicitWrapper _.chain(object).unset("a.b"); // $ExpectType LoDashExplicitWrapper _.chain(object).unset(["a", "b"]); // $ExpectType LoDashExplicitWrapper fp.unset("a.b", object); // $ExpectType { a: { b: string; c: boolean; }; } fp.unset("a.b")(object); // $ExpectType { a: { b: string; c: boolean; }; } fp.unset(["a", "b"])(object); // $ExpectType { a: { b: string; c: boolean; }; } } // _.update { const object = { a: { b: [0] } }; const updater = (value: any) => 0; _.update(object, "a.b[1]", updater); // $ExpectType any _.update(object, ["a", "b", 1], updater); // $ExpectType any _(object).update("a.b[1]", updater); // $ExpectType LoDashImplicitWrapper _(object).update(["a", "b", 1], updater); // $ExpectType LoDashImplicitWrapper _.chain(object).update("a.b[1]", updater); // $ExpectType LoDashExplicitWrapper _.chain(object).update(["a", "b", 1], updater); // $ExpectType LoDashExplicitWrapper fp.update("a.b[1]", updater, object); // $ExpectType any fp.update(["a", "b", 1])(updater)(object); // $ExpectType any } // _.updateWith { interface SampleResult { a: { b: number[]; }; } const object: SampleResult = { a: { b: [] } }; const updater = (value: any) => 0; const customizer = (value: any, key: string, object: SampleResult) => 0; _.updateWith(object, "a.b[1]", updater); // $ExpectType SampleResult _.updateWith(object, "a.b[1]", updater, customizer); // $ExpectType SampleResult _.updateWith(object, ["a", "b", 1], updater, customizer); // $ExpectType SampleResult _(object).updateWith("a.b[1]", updater); // $ExpectType LoDashImplicitWrapper _(object).updateWith("a.b[1]", updater, customizer); // $ExpectType LoDashImplicitWrapper _(object).updateWith(["a", "b", 1], updater, customizer); // $ExpectType LoDashImplicitWrapper _.chain(object).updateWith("a.b[1]", updater, customizer); // $ExpectType LoDashExplicitWrapper fp.updateWith(customizer, "a.b[1]", updater, object); // $ExpectType SampleResult fp.updateWith(customizer)(["a", "b", 1])(updater)(object); // $ExpectType SampleResult } // _.values // _.valuesIn { const dict: _.Dictionary = {}; const numDict: _.NumericDictionary = {}; _.values(123); // $ExpectType any[] _.values(true); // $ExpectType any[] _.values("hi"); // $ExpectType string[] _.values(["h", "i"]); // $ExpectType string[] _.values([true, false]); // $ExpectType boolean[] _.values(dict); // $ExpectType AbcObject[] _.values(numDict); // $ExpectType AbcObject[] _.values(list); // $ExpectType AbcObject[] _.values(abcObject); // $ExpectType (string | number | boolean)[] _(true).values(); // $ExpectType LoDashImplicitWrapper _("hi").values(); // $ExpectType LoDashImplicitWrapper _(dict).values(); // $ExpectType LoDashImplicitWrapper _.chain(true).values(); // $ExpectType LoDashExplicitWrapper _.chain("hi").values(); // $ExpectType LoDashExplicitWrapper _.chain(dict).values(); // $ExpectType LoDashExplicitWrapper fp.values("hi"); // $ExpectType string[] fp.values(["h", "i"]); // $ExpectType string[] fp.values([true, false]); // $ExpectType boolean[] fp.values(dict); // $ExpectType AbcObject[] fp.values(numDict); // $ExpectType AbcObject[] fp.values(list); // $ExpectType AbcObject[] fp.values(abcObject); // $ExpectType (string | number | boolean)[] _.valuesIn([true, false]); // $ExpectType boolean[] _.valuesIn(dict); // $ExpectType AbcObject[] _.valuesIn(numDict); // $ExpectType AbcObject[] _.valuesIn(list); // $ExpectType AbcObject[] _.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] _(dict).valuesIn(); // $ExpectType LoDashImplicitWrapper _.chain(dict).valuesIn(); // $ExpectType LoDashExplicitWrapper fp.valuesIn(dict); // $ExpectType AbcObject[] fp.valuesIn(numDict); // $ExpectType AbcObject[] fp.valuesIn(list); // $ExpectType AbcObject[] fp.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] } /******* * Seq * *******/ // _ { _(""); // $ExpectType LoDashImplicitWrapper _(42); // $ExpectType LoDashImplicitWrapper _(true); // $ExpectType LoDashImplicitWrapper _([""]); // $ExpectType LoDashImplicitWrapper _({ a: "" }); // $ExpectType LoDashImplicitWrapper<{ a: string; }> _(array); // $ExpectType LoDashImplicitWrapper } // _.chain { _.chain(""); // $ExpectType LoDashExplicitWrapper _("").chain(); // $ExpectType LoDashExplicitWrapper _.chain("").chain(); // $ExpectType LoDashExplicitWrapper _.chain(42); // $ExpectType LoDashExplicitWrapper _.chain([""]); // $ExpectType LoDashExplicitWrapper _.chain({ a: 42 }); // $ExpectType LoDashExplicitWrapper<{ a: number; }> } // _.tap { // $ExpectType string _.tap("a", (value) => { value; // $ExpectType string }); // $ExpectType boolean[] _.tap([true], (value) => { value; // $ExpectType boolean[] }); // $ExpectType { a: number; } _.tap({ a: 42 }, (value) => { value; // $ExpectType { a: number; } }); // $ExpectType LoDashImplicitWrapper _("a").tap((value) => { value; // $ExpectType string }); // $ExpectType LoDashImplicitWrapper _([true]).tap((value) => { value; // $ExpectType boolean[] }); // $ExpectType LoDashImplicitWrapper<{ a: number; }> _({ a: 42 }).tap((value) => { value; // $ExpectType { a: number; } }); // $ExpectType LoDashExplicitWrapper _.chain("a").tap((value) => { value; // $ExpectType string }); // $ExpectType LoDashExplicitWrapper _.chain([true]).tap((value) => { value; // $ExpectType boolean[] }); // $ExpectType LoDashExplicitWrapper<{ a: number; }> _.chain({ a: 42 }).tap((value) => { value; // $ExpectType { a: number; } }); fp.tap((value: string) => {}, "a" as string); // $ExpectType string fp.tap((value: string) => {})("a"); // $ExpectType string fp.tap((value: string[]) => {}, ["a"]); // $ExpectType string[] } // _.thru { // $ExpectType number _.thru("a", (value) => { value; // $ExpectType string return 1; }); // $ExpectType number _.thru([true], (value) => { value; // $ExpectType boolean[] return 1; }); // $ExpectType number _.thru({ a: 42 }, (value) => { value; // $ExpectType { a: number; } return 1; }); // $ExpectType LoDashImplicitWrapper _("a").thru((value) => { value; // $ExpectType string return 1; }); // $ExpectType LoDashImplicitWrapper _([true]).thru((value) => { value; // $ExpectType boolean[] return 1; }); // $ExpectType LoDashImplicitWrapper _({ a: 42 }).thru((value) => { value; // $ExpectType { a: number; } return 1; }); // $ExpectType LoDashExplicitWrapper _.chain("a").thru((value) => { value; // $ExpectType string return 1; }); // $ExpectType LoDashExplicitWrapper _.chain([true]).thru((value) => { value; // $ExpectType boolean[] return 1; }); // $ExpectType LoDashExplicitWrapper _.chain({ a: 42 }).thru((value) => { value; // $ExpectType { a: number; } return 1; }); fp.thru((x: number) => x.toString(), 1); // $ExpectType string fp.thru((x: number) => x.toString())(1); // $ExpectType string fp.thru((x: number[]) => x.toString())([1]); // $ExpectType string } // _.prototype.commit { _(42).commit(); // $ExpectType LoDashImplicitWrapper _({ a: 42 }).commit(); // $ExpectType LoDashImplicitWrapper<{ a: number; }> _.chain(42).commit(); // $ExpectType LoDashExplicitWrapper _.chain({ a: 42 }).commit(); // $ExpectType LoDashExplicitWrapper<{ a: number; }> } // _.prototype.concat { const numberROA: ReadonlyArray = [0]; _.concat(1); // $ExpectType number[] _.concat([1]); // $ExpectType number[] _.concat(numberROA); // $ExpectType number[] _.concat(1, 2); // $ExpectType number[] _.concat(1, [1]); // $ExpectType number[] _.concat(1, [1], numberROA); // $ExpectType number[] _(1).concat(2); // $ExpectType LoDashImplicitWrapper _(1).concat([1]); // $ExpectType LoDashImplicitWrapper _(1).concat([2], numberROA); // $ExpectType LoDashImplicitWrapper _([1]).concat(2); // $ExpectType LoDashImplicitWrapper _(numberROA).concat(numberROA); // $ExpectType LoDashImplicitWrapper _(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashImplicitWrapper _.chain(1).concat(2); // $ExpectType LoDashExplicitWrapper _.chain(1).concat([1]); // $ExpectType LoDashExplicitWrapper _.chain(1).concat([2], numberROA); // $ExpectType LoDashExplicitWrapper _.chain([1]).concat(2); // $ExpectType LoDashExplicitWrapper _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper const objectROA: ReadonlyArray = [{ a: 1, b: 'foo', c: true }]; _.concat(abcObject, abcObject); // $ExpectType AbcObject[] _.concat(abcObject, [abcObject], objectROA); // $ExpectType AbcObject[] _(abcObject).concat(abcObject); // $ExpectType LoDashImplicitWrapper _(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashImplicitWrapper _.chain(abcObject).concat(abcObject); // $ExpectType LoDashExplicitWrapper _.chain(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashExplicitWrapper } // _.prototype.plant { _(anything).plant(""); // $ExpectType LoDashImplicitWrapper _(anything).plant(42); // $ExpectType LoDashImplicitWrapper _(anything).plant([""]); // $ExpectType LoDashImplicitWrapper _(anything).plant({ a: 42 }); // $ExpectType LoDashImplicitWrapper<{ a: number; }> _.chain(anything).plant(""); // $ExpectType LoDashExplicitWrapper _.chain(anything).plant(42); // $ExpectType LoDashExplicitWrapper _.chain(anything).plant([""]); // $ExpectType LoDashExplicitWrapper _.chain(anything).plant({ a: 42 }); // $ExpectType LoDashExplicitWrapper<{ a: number; }> } // _.prototype.reverse { _([42]).reverse(); // $ExpectType LoDashImplicitWrapper _.chain([42]).reverse(); // $ExpectType LoDashExplicitWrapper } // _.prototype.toString { _('').toString(); // $ExpectType string _(42).toString(); // $ExpectType string _([true]).toString(); // $ExpectType string _({}).toString(); // $ExpectType string _.chain('').toString(); // $ExpectType string _.chain(42).toString(); // $ExpectType string _.chain([true]).toString(); // $ExpectType string _.chain({}).toString(); // $ExpectType string } // _.prototype.value // _.prototype.valueOf // _.prototype.toJSON { _("").value(); // $ExpectType string _([true]).value(); // $ExpectType boolean[] _({ a: 42 }).value(); // $ExpectType { a: number; } _({ a: 42 }).valueOf(); // $ExpectType { a: number; } _({ a: 42 }).toJSON(); // $ExpectType { a: number; } _.chain("").value(); // $ExpectType string _.chain([true]).value(); // $ExpectType boolean[] _.chain({ a: 42 }).value(); // $ExpectType { a: number; } _.chain({ a: 42 }).valueOf(); // $ExpectType { a: number; } _.chain({ a: 42 }).toJSON(); // $ExpectType { a: number; } } /********** * String * **********/ // _.camelCase { _.camelCase("Foo Bar"); // $ExpectType string _("Foo Bar").camelCase(); // $ExpectType string _.chain("Foo Bar").camelCase(); // $ExpectType LoDashExplicitWrapper fp.camelCase("Foo Bar"); // $ExpectType string } // _.capitalize { _.capitalize("fred"); // $ExpectType string _("fred").capitalize(); // $ExpectType string _.chain("fred").capitalize(); // $ExpectType LoDashExplicitWrapper fp.capitalize("fred"); // $ExpectType string } // _.deburr { _.deburr("déjà vu"); // $ExpectType string _("déjà vu").deburr(); // $ExpectType string _.chain("déjà vu").deburr(); // $ExpectType LoDashExplicitWrapper fp.deburr("déjà vu"); // $ExpectType string } // _.endsWith { _.endsWith("abc", "c"); // $ExpectType boolean _.endsWith("abc", "c", 1); // $ExpectType boolean _("abc").endsWith("c"); // $ExpectType boolean _("abc").endsWith("c", 1); // $ExpectType boolean _.chain("abc").endsWith("c"); // $ExpectType LoDashExplicitWrapper _.chain("abc").endsWith("c", 1); // $ExpectType LoDashExplicitWrapper fp.endsWith("c", "abc"); // $ExpectType boolean fp.endsWith("c")("abc"); // $ExpectType boolean } // _.escape { _.escape("fred, barney, & pebbles"); // $ExpectType string _("fred, barney, & pebbles").escape(); // $ExpectType string _.chain("fred, barney, & pebbles").escape(); // $ExpectType LoDashExplicitWrapper fp.escape("fred, barney, & pebbles"); // $ExpectType string } // _.escapeRegExp { _.escapeRegExp("[lodash](https://lodash.com/)"); // $ExpectType string _("[lodash](https://lodash.com/)").escapeRegExp(); // $ExpectType string _.chain("[lodash](https://lodash.com/)").escapeRegExp(); // $ExpectType LoDashExplicitWrapper fp.escapeRegExp("[lodash](https://lodash.com/)"); // $ExpectType string } // _.kebabCase { _.kebabCase("Foo Bar"); // $ExpectType string _("Foo Bar").kebabCase(); // $ExpectType string _.chain("Foo Bar").kebabCase(); // $ExpectType LoDashExplicitWrapper fp.kebabCase("Foo Bar"); // $ExpectType string } // _.lowerCase { _.lowerCase("Foo Bar"); // $ExpectType string _("Foo Bar").lowerCase(); // $ExpectType string _.chain("Foo Bar").lowerCase(); // $ExpectType LoDashExplicitWrapper fp.lowerCase("Foo Bar"); // $ExpectType string } // _.lowerFirst { _.lowerFirst("Foo Bar"); // $ExpectType string _("Foo Bar").lowerFirst(); // $ExpectType string _.chain("Foo Bar").lowerFirst(); // $ExpectType LoDashExplicitWrapper fp.lowerFirst("Foo Bar"); // $ExpectType string } // _.pad { _.pad("abc"); // $ExpectType string _.pad("abc", 8); // $ExpectType string _.pad("abc", 8, "_-"); // $ExpectType string _("abc").pad(); // $ExpectType string _("abc").pad(8); // $ExpectType string _("abc").pad(8, "_-"); // $ExpectType string _.chain("abc").pad(); // $ExpectType LoDashExplicitWrapper _.chain("abc").pad(8); // $ExpectType LoDashExplicitWrapper _.chain("abc").pad(8, "_-"); // $ExpectType LoDashExplicitWrapper fp.pad(8, "abc"); // $ExpectType string fp.pad(8)("abc"); // $ExpectType string fp.padChars("_", 8, "abc"); // $ExpectType string fp.padChars("_")(8)("abc"); // $ExpectType string } // _.padEnd { _.padEnd("abc"); // $ExpectType string _.padEnd("abc", 6); // $ExpectType string _.padEnd("abc", 6, "_-"); // $ExpectType string _("abc").padEnd(); // $ExpectType string _("abc").padEnd(6); // $ExpectType string _("abc").padEnd(6, "_-"); // $ExpectType string _.chain("abc").padEnd(); // $ExpectType LoDashExplicitWrapper _.chain("abc").padEnd(6); // $ExpectType LoDashExplicitWrapper _.chain("abc").padEnd(6, "_-"); // $ExpectType LoDashExplicitWrapper fp.padEnd(8, "abc"); // $ExpectType string fp.padEnd(8)("abc"); // $ExpectType string fp.padCharsEnd("_", 8, "abc"); // $ExpectType string fp.padCharsEnd("_")(8)("abc"); // $ExpectType string } // _.padStart { _.padStart("abc"); // $ExpectType string _.padStart("abc", 6); // $ExpectType string _.padStart("abc", 6, "_-"); // $ExpectType string _("abc").padStart(); // $ExpectType string _("abc").padStart(6); // $ExpectType string _("abc").padStart(6, "_-"); // $ExpectType string _.chain("abc").padStart(); // $ExpectType LoDashExplicitWrapper _.chain("abc").padStart(6); // $ExpectType LoDashExplicitWrapper _.chain("abc").padStart(6, "_-"); // $ExpectType LoDashExplicitWrapper fp.padStart(8, "abc"); // $ExpectType string fp.padStart(8)("abc"); // $ExpectType string fp.padCharsStart("_", 8, "abc"); // $ExpectType string fp.padCharsStart("_")(8)("abc"); // $ExpectType string } // _.parseInt { _.parseInt("08"); // $ExpectType number _.parseInt("08", 10); // $ExpectType number _("08").parseInt(); // $ExpectType number _("08").parseInt(10); // $ExpectType number _.chain("08").parseInt(); // $ExpectType LoDashExplicitWrapper _.chain("08").parseInt(10); // $ExpectType LoDashExplicitWrapper fp.parseInt(10, "08"); // $ExpectType number fp.parseInt(10)("08"); // $ExpectType number } // _.repeat { _.repeat("*"); // $ExpectType string _.repeat("*", 3); // $ExpectType string _("*").repeat(); // $ExpectType string _("*").repeat(3); // $ExpectType string _.chain("*").repeat(); // $ExpectType LoDashExplicitWrapper _.chain("*").repeat(3); // $ExpectType LoDashExplicitWrapper fp.repeat(3, "*"); // $ExpectType string } // _.replace { const replacer = (match: string, offset: number, string: string) => "Barney"; _.replace("Hi Fred", "Fred", "Barney"); // $ExpectType string _.replace("Hi Fred", "Fred", replacer); // $ExpectType string _.replace("Hi Fred", /fred/i, "Barney"); // $ExpectType string _.replace("Hi Fred", /fred/i, replacer); // $ExpectType string _("Hi Fred").replace("Fred", "Barney"); // $ExpectType string _("Hi Fred").replace("Fred", replacer); // $ExpectType string _("Hi Fred").replace(/fred/i, "Barney"); // $ExpectType string _("Hi Fred").replace(/fred/i, replacer); // $ExpectType string _.chain("Hi Fred").replace("Fred", "Barney"); // $ExpectType LoDashExplicitWrapper _.chain("Hi Fred").replace("Fred", replacer); // $ExpectType LoDashExplicitWrapper _.chain("Hi Fred").replace(/fred/i, "Barney"); // $ExpectType LoDashExplicitWrapper _.chain("Hi Fred").replace(/fred/i, replacer); // $ExpectType LoDashExplicitWrapper fp.replace("Fred", "Barney", "Hi Fred"); // $ExpectType string fp.replace("Fred")("Barney")("Hi Fred"); // $ExpectType string fp.replace("Fred")(replacer)("Hi Fred"); // $ExpectType string fp.replace(/fred/i)("Barney")("Hi Fred"); // $ExpectType string fp.replace(/fred/i)(replacer)("Hi Fred"); // $ExpectType string } // _.snakeCase { _.snakeCase("Foo Bar"); // $ExpectType string _("Foo Bar").snakeCase(); // $ExpectType string _.chain("Foo Bar").snakeCase(); // $ExpectType LoDashExplicitWrapper fp.snakeCase("Foo Bar"); // $ExpectType string } // _.split { _.split("a-b-c"); // $ExpectType string[] _.split("a-b-c", "-"); // $ExpectType string[] _.split("a-b-c", "-", 2); // $ExpectType string[] _("a-b-c").split(); // $ExpectType LoDashImplicitWrapper _("a-b-c").split("-"); // $ExpectType LoDashImplicitWrapper _("a-b-c").split("-", 2); // $ExpectType LoDashImplicitWrapper _.chain("a-b-c").split(); // $ExpectType LoDashExplicitWrapper _.chain("a-b-c").split("-"); // $ExpectType LoDashExplicitWrapper _.chain("a-b-c").split("-", 2); // $ExpectType LoDashExplicitWrapper fp.split("-", "a-b-c"); // $ExpectType string[] fp.split("-")("a-b-c"); // $ExpectType string[] _.map(["abc", "def"], _.split); // $ExpectType string[][] } // _.startCase { _.startCase("--foo-bar"); // $ExpectType string _("--foo-bar").startCase(); // $ExpectType string _.chain("--foo-bar").startCase(); // $ExpectType LoDashExplicitWrapper fp.startCase("--foo-bar"); // $ExpectType string } // _.startsWith { _.startsWith("abc", "a"); // $ExpectType boolean _.startsWith("abc", "a", 1); // $ExpectType boolean _("abc").startsWith("a"); // $ExpectType boolean _("abc").startsWith("a", 1); // $ExpectType boolean _.chain("abc").startsWith("a"); // $ExpectType LoDashExplicitWrapper _.chain("abc").startsWith("a", 1); // $ExpectType LoDashExplicitWrapper fp.startsWith("a", "abc"); // $ExpectType boolean fp.startsWith("a")("abc"); // $ExpectType boolean } // _.template { const options: _.TemplateOptions = { escape: / /, evaluate: / /, imports: {}, interpolate: / /, sourceURL: "", variable: "a", }; const result = _.template(""); result.source; // $ExpectType string result({}); // $ExpectType string _.template(""); // $ExpectType TemplateExecutor _.template("", options); // $ExpectType TemplateExecutor _("").template(); // $ExpectType TemplateExecutor _("").template(options); // $ExpectType TemplateExecutor _.chain("").template(); // $ExpectType LoDashExplicitWrapper _.chain("").template(options); // $ExpectType LoDashExplicitWrapper const result2 = fp.template(""); result2(); // $ExpectType string result2.source; // $ExpectType string } // _.toLower { _.toLower("fred, barney, & pebbles"); // $ExpectType string _("fred, barney, & pebbles").toLower(); // $ExpectType string _.chain("fred, barney, & pebbles").toLower(); // $ExpectType LoDashExplicitWrapper fp.toLower("fred, barney, & pebbles"); // $ExpectType string } // _.toUpper { _.toUpper("fred, barney, & pebbles"); // $ExpectType string _("fred, barney, & pebbles").toUpper(); // $ExpectType string _.chain("fred, barney, & pebbles").toUpper(); // $ExpectType LoDashExplicitWrapper fp.toUpper("fred, barney, & pebbles"); // $ExpectType string } // _.trim { _.trim(); // $ExpectType string _.trim(" abc "); // $ExpectType string _.trim("-_-abc-_-", "_-"); // $ExpectType string _("-_-abc-_-").trim(); // $ExpectType string _("-_-abc-_-").trim("_-"); // $ExpectType string _.chain("-_-abc-_-").trim(); // $ExpectType LoDashExplicitWrapper _.chain("-_-abc-_-").trim("_-"); // $ExpectType LoDashExplicitWrapper fp.trim(" abc "); // $ExpectType string fp.trimChars(" ", " abc "); // $ExpectType string fp.trimChars(" ")(" abc "); // $ExpectType string _.map([" foo ", " bar "], _.trim); // $ExpectType string[] } // _.trimEnd { _.trimEnd(); // $ExpectType string _.trimEnd(" abc "); // $ExpectType string _.trimEnd("-_-abc-_-", "_-"); // $ExpectType string _("-_-abc-_-").trimEnd(); // $ExpectType string _("-_-abc-_-").trimEnd("_-"); // $ExpectType string _.chain("-_-abc-_-").trimEnd(); // $ExpectType LoDashExplicitWrapper _.chain("-_-abc-_-").trimEnd("_-"); // $ExpectType LoDashExplicitWrapper fp.trimEnd(" abc "); // $ExpectType string fp.trimCharsEnd(" ", " abc "); // $ExpectType string fp.trimCharsEnd(" ")(" abc "); // $ExpectType string } // _.trimStart { _.trimStart(); // $ExpectType string _.trimStart(" abc "); // $ExpectType string _.trimStart("-_-abc-_-", "_-"); // $ExpectType string _("-_-abc-_-").trimStart(); // $ExpectType string _("-_-abc-_-").trimStart("_-"); // $ExpectType string _.chain("-_-abc-_-").trimStart(); // $ExpectType LoDashExplicitWrapper _.chain("-_-abc-_-").trimStart("_-"); // $ExpectType LoDashExplicitWrapper fp.trimStart(" abc "); // $ExpectType string fp.trimCharsStart(" ", " abc "); // $ExpectType string fp.trimCharsStart(" ")(" abc "); // $ExpectType string } // _.truncate { _.truncate("hi-diddly-ho there, neighborino"); // $ExpectType string _.truncate("hi-diddly-ho there, neighborino", { length: 24, separator: " " }); // $ExpectType string _.truncate("hi-diddly-ho there, neighborino", { length: 24, separator: /,? +/ }); // $ExpectType string _.truncate("hi-diddly-ho there, neighborino", { omission: " […]" }); // $ExpectType string _("hi-diddly-ho there, neighborino").truncate(); // $ExpectType string _("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: " " }); // $ExpectType string _("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: /,? +/ }); // $ExpectType string _("hi-diddly-ho there, neighborino").truncate({ omission: " […]" }); // $ExpectType string _.chain("hi-diddly-ho there, neighborino").truncate(); // $ExpectType LoDashExplicitWrapper _.chain("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: " " }); // $ExpectType LoDashExplicitWrapper _.chain("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: /,? +/ }); // $ExpectType LoDashExplicitWrapper _.chain("hi-diddly-ho there, neighborino").truncate({ omission: " […]" }); // $ExpectType LoDashExplicitWrapper fp.truncate({ length: 24, separator: " " }, "hi-diddly-ho there, neighborino"); // $ExpectType string fp.truncate({ length: 24, separator: " " })("hi-diddly-ho there, neighborino"); // $ExpectType string fp.truncate({ length: 24, separator: /,? +/ }, "hi-diddly-ho there, neighborino"); // $ExpectType string fp.truncate({ omission: " […]" }, "hi-diddly-ho there, neighborino"); // $ExpectType string } // _.unescape { _.unescape("fred, barney, & pebbles"); // $ExpectType string _("fred, barney, & pebbles").unescape(); // $ExpectType string _.chain("fred, barney, & pebbles").unescape(); // $ExpectType LoDashExplicitWrapper fp.unescape("fred, barney, & pebbles"); // $ExpectType string } // _.upperCase { _.upperCase("fred, barney, & pebbles"); // $ExpectType string _("fred, barney, & pebbles").upperCase(); // $ExpectType string _.chain("fred, barney, & pebbles").upperCase(); // $ExpectType LoDashExplicitWrapper fp.upperCase("fred, barney, & pebbles"); // $ExpectType string } // _.upperFirst { _.upperFirst("fred, barney, & pebbles"); // $ExpectType string _("fred, barney, & pebbles").upperFirst(); // $ExpectType string _.chain("fred, barney, & pebbles").upperFirst(); // $ExpectType LoDashExplicitWrapper fp.upperFirst("fred, barney, & pebbles"); // $ExpectType string } // _.words { _.words("fred, barney, & pebbles"); // $ExpectType string[] _.words("fred, barney, & pebbles", /[^, ]+/g); // $ExpectType string[] _("fred, barney, & pebbles").words(); // $ExpectType string[] _("fred, barney, & pebbles").words(/[^, ]+/g); // $ExpectType string[] _.chain("fred, barney, & pebbles").words(); // $ExpectType LoDashExplicitWrapper _.chain("fred, barney, & pebbles").words(/[^, ]+/g); // $ExpectType LoDashExplicitWrapper fp.words("fred, barney, & pebbles"); // $ExpectType string[] _.map(["fred, barney", "pebbles"], _.words); // $ExpectType string[][] } /******** * Util * ********/ // _.attempt { const func = (...args: any[]): AbcObject => anything; // We can't use ExpectType here because typescript keeps changing what order the types appear. let result: Error | AbcObject; result = _.attempt(func); result = _.attempt(func, "foo", "bar", "baz"); result = _(func).attempt(); result = _(func).attempt("foo", "bar", "baz"); let explicitResult: _.LoDashExplicitWrapper; explicitResult = _.chain(func).attempt(); explicitResult = _.chain(func).attempt("foo", "bar", "baz"); result = fp.attempt(func); } // _.cond { const pairPred1 = (val: string) => true; const pairPred2 = (val: string) => false; const pairRes1 = (val: string) => 1; const pairRes2 = (val: string) => 2; _.cond([[pairPred1, pairRes1], [pairPred2, pairRes2]])("hello"); // $ExpectType number fp.cond([[pairPred1, pairRes1], [pairPred2, pairRes2]])("hello"); // $ExpectType number } // _.constant { _.constant(42); // $ExpectType () => number _.constant("a"); // $ExpectType () => string _.constant([true]); // $ExpectType () => boolean[] _.constant({ a: "" }); // $ExpectType () => { a: string; } _(42).constant(); // $ExpectType LoDashImplicitWrapper<() => number> _("a").constant(); // $ExpectType LoDashImplicitWrapper<() => string> _([true]).constant(); // $ExpectType LoDashImplicitWrapper<() => boolean[]> _({ a: "" }).constant(); // $ExpectType LoDashImplicitWrapper<() => { a: string; }> _.chain(42).constant(); // $ExpectType LoDashExplicitWrapper<() => number> _.chain("a").constant(); // $ExpectType LoDashExplicitWrapper<() => string> _.chain([true]).constant(); // $ExpectType LoDashExplicitWrapper<() => boolean[]> _.chain({ a: "" }).constant(); // $ExpectType LoDashExplicitWrapper<() => { a: string; }> fp.constant(42); // $ExpectType () => number fp.constant("a"); // $ExpectType () => string fp.constant([true]); // $ExpectType () => boolean[] fp.constant({ a: "" }); // $ExpectType () => { a: string; } } // _.defaultTo { _.defaultTo(42, 42); // $ExpectType 42 _.defaultTo(undefined, 42); // $ExpectType 42 _.defaultTo(null, 42); // $ExpectType 42 _.defaultTo(NaN, 42); // $ExpectType number _.defaultTo(undefined, "default"); // $ExpectType "default" _.defaultTo(undefined, [true]); // $ExpectType boolean[] _.defaultTo(undefined, { a: "" }); // $ExpectType { a: string; } _(42).defaultTo(42); // $ExpectType number _(undefined).defaultTo(42); // $ExpectType 42 _(null).defaultTo(42); // $ExpectType 42 _(NaN).defaultTo(42); // $ExpectType number _(undefined).defaultTo("default"); // $ExpectType "default" _(undefined).defaultTo([true]); // $ExpectType boolean[] _(undefined).defaultTo({ a: "" }); // $ExpectType { a: string; } _.chain(42).defaultTo(42); // $ExpectType LoDashExplicitWrapper const z1: _.LoDashExplicitWrapper = _.chain(undefined).defaultTo(42); const z2: _.LoDashExplicitWrapper = _.chain(null).defaultTo(42); _.chain(NaN).defaultTo(42); // $ExpectType LoDashExplicitWrapper const z3: _.LoDashExplicitWrapper = _.chain(undefined).defaultTo("default"); _.chain(undefined).defaultTo([true]); // $ExpectType LoDashExplicitWrapper _.chain(undefined).defaultTo({ a: "" }); // $ExpectType LoDashExplicitWrapper<{ a: string; }> const n: number = anything; fp.defaultTo(42, n); // $ExpectType number fp.defaultTo(42)(n); // $ExpectType number fp.defaultTo(42)(undefined); // $ExpectType number fp.defaultTo(42)(null); // $ExpectType number fp.defaultTo(42)(NaN); // $ExpectType number const arr: boolean[] | undefined = anything; const result: boolean[] | "a" = fp.defaultTo("a", arr); } // _.identity { _.identity(42); // $ExpectType 42 _.identity([""]); // $ExpectType string[] _.identity({ a: true }); // $ExpectType { a: boolean; } _(42).identity(); // $ExpectType number _([""]).identity(); // $ExpectType string[] _({ a: true }).identity(); // $ExpectType { a: boolean; } _.chain(42).identity(); // $ExpectType LoDashExplicitWrapper _.chain([""]).identity(); // $ExpectType LoDashExplicitWrapper _.chain({ a: true }).identity(); // $ExpectType LoDashExplicitWrapper<{ a: boolean; }> fp.identity(42); // $ExpectType 42 fp.identity([""]); // $ExpectType string[] fp.identity({ a: true }); // $ExpectType { a: boolean; } } // _.iteratee { _.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean _.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject _.iteratee("a"); // $ExpectType (...args: any[]) => any _.iteratee({ a: 42 }); // $ExpectType (...args: any[]) => any _.iteratee(["a", 42]); // $ExpectType (...args: any[]) => any _((a: AbcObject): boolean => anything).iteratee(); // $ExpectType LoDashImplicitWrapper<(a: AbcObject) => boolean> _("a").iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _({ a: 42 }).iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _(["a", 42]).iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain((a: AbcObject): boolean => anything).iteratee(); // $ExpectType LoDashExplicitWrapper<(a: AbcObject) => boolean> _.chain("a").iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain({ a: 42 }).iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> _.chain(["a", 42]).iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean fp.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject fp.iteratee(""); // $ExpectType (...args: any[]) => any fp.iteratee({ a: 42 }); // $ExpectType (...args: any[]) => any fp.iteratee(["a", 42]); // $ExpectType (...args: any[]) => any } // _.matches { _.matches(abcObject); // $ExpectType (value: any) => boolean _.matches(abcObject); // $ExpectType (value: AbcObject) => boolean _(abcObject).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> _.chain(abcObject).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> fp.matches(abcObject, {}); // $ExpectType boolean fp.matches(abcObject)({}); // $ExpectType boolean } // _.matchesProperty { const path: string | string[] = anything; _.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean _.matchesProperty(path, abcObject); // $ExpectType (value: AbcObject) => boolean _(path).matchesProperty(abcObject); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> _(path).matchesProperty(abcObject); _.chain(path).matchesProperty(abcObject); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> fp.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean } // _.method { _.method("a.0"); // $ExpectType (object: any) => any _.method("a.0", anything, anything, anything); // $ExpectType (object: any) => any _.method(["a", 0]); // $ExpectType (object: any) => any _.method(["a", 0], anything, anything, anything); // $ExpectType (object: any) => any _("a.0").method(); // $ExpectType LoDashImplicitWrapper<(object: any) => any> _("a.0").method(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(object: any) => any> _(["a", 0]).method(); // $ExpectType LoDashImplicitWrapper<(object: any) => any> _(["a", 0]).method(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(object: any) => any> _.chain("a.0").method(); // $ExpectType LoDashExplicitWrapper<(object: any) => any> _.chain("a.0").method(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(object: any) => any> _.chain(["a", 0]).method(); // $ExpectType LoDashExplicitWrapper<(object: any) => any> _.chain(["a", 0]).method(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(object: any) => any> fp.method("a.0"); // $ExpectType (object: any) => any fp.method(["a", 0]); // $ExpectType (object: any) => any fp.method(Symbol.replace); // $ExpectType (object: any) => any } // _.methodOf { _.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; _.methodOf(abcObject, anything, anything, anything) as (path: _.Many<_.PropertyName>) => any; _(abcObject).methodOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; _(abcObject).methodOf(anything, anything, anything) as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; _.chain(abcObject).methodOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; _.chain(abcObject).methodOf(anything, anything, anything) as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; fp.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; } // _.mixin { const source: _.Dictionary<(...args: any[]) => any> = {}; const dest: AbcObject = anything; const options: {chain?: boolean} = {}; _.mixin(source); // $ExpectType LoDashStatic _.mixin(source, options); // $ExpectType LoDashStatic _.mixin(dest, source); // $ExpectType AbcObject _.mixin(dest, source, options); // $ExpectType AbcObject _(source).mixin(); // $ExpectType LoDashImplicitWrapper _(source).mixin(options); // $ExpectType LoDashImplicitWrapper _(dest).mixin(source); // $ExpectType LoDashImplicitWrapper _(dest).mixin(source, options); // $ExpectType LoDashImplicitWrapper _.chain(source).mixin(); // $ExpectType LoDashExplicitWrapper _.chain(source).mixin(options); // $ExpectType LoDashExplicitWrapper _.chain(dest).mixin(source); // $ExpectType LoDashExplicitWrapper _.chain(dest).mixin(source, options); // $ExpectType LoDashExplicitWrapper } // _.noConflict { _.noConflict(); // $ExpectType LoDashStatic _(42).noConflict(); // $ExpectType LoDashStatic _.chain(42).noConflict(); // $ExpectType LoDashExplicitWrapper fp.noConflict(); // $ExpectType LoDashFp } // _.noop { _.noop(); // $ExpectType void _.noop(1); // $ExpectType void _.noop(true, "a", 1); // $ExpectType void _("a").noop(true, "a", 1); // $ExpectType void _.chain("a").noop(true, "a", 1); // $ExpectType LoDashExplicitWrapper fp.noop(); // $ExpectType void fp.noop(1); // $ExpectType void fp.noop(true, "a", 1); // $ExpectType void } { _.nthArg(); // $ExpectType (...args: any[]) => any _.nthArg(1); // $ExpectType (...args: any[]) => any _(1).nthArg(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> _.chain(1).nthArg(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> fp.nthArg(1); // $ExpectType (...args: any[]) => any } // _.over { _.over(Math.max); // $ExpectType (...args: any[]) => number[] _.over(Math.max, Math.min); // $ExpectType (...args: any[]) => number[] _.over([Math.max]); // $ExpectType (...args: any[]) => number[] _.over([Math.max], [Math.min]); // $ExpectType (...args: any[]) => number[] _(Math.max).over(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> _(Math.max).over(Math.min); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> _([Math.max]).over(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> _([Math.max]).over([Math.min]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> _.chain(Math.max).over(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> _.chain(Math.max).over(Math.min); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> _.chain([Math.max]).over(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> _.chain([Math.max]).over([Math.min]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> fp.over(Math.max); // $ExpectType (...args: any[]) => number[] fp.over([Math.max, Math.min]); // $ExpectType (...args: any[]) => number[] } // _.overEvery // _.overSome { _.overEvery((number: number) => true); // $ExpectType (...args: number[]) => boolean _.overEvery((number: number) => true, (number: number) => true); // $ExpectType (...args: number[]) => boolean _.overEvery([(number: number) => true]); // $ExpectType (...args: number[]) => boolean _.overEvery([(number: number) => true], [(number: number) => true]); // $ExpectType (...args: number[]) => boolean _(Math.max).overEvery(); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> _(Math.max).overEvery((number: number) => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> _([Math.max]).overEvery([(number: number) => true]); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> _.chain(Math.max).overEvery(); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> _.chain(Math.max).overEvery((number: number) => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> _.chain([Math.max]).overEvery([(number: number) => true]); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> fp.overEvery((number: number) => true); // $ExpectType (...args: number[]) => boolean fp.overEvery([(number: number) => true, (number: number) => true]); // $ExpectType (...args: number[]) => boolean _.overSome((number: number) => true); // $ExpectType (...args: number[]) => boolean _.overSome((number: number) => true, (number: number) => true); // $ExpectType (...args: number[]) => boolean _.overSome([(number: number) => true]); // $ExpectType (...args: number[]) => boolean _.overSome([(number: number) => true], [(number: number) => true]); // $ExpectType (...args: number[]) => boolean _(Math.max).overSome(); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> _(Math.max).overSome((number: number) => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> _([Math.max]).overSome([(number: number) => true]); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> _.chain(Math.max).overSome(); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> _.chain(Math.max).overSome((number: number) => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> _.chain([Math.max]).overSome([(number: number) => true]); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> fp.overSome((number: number) => true); // $ExpectType (...args: number[]) => boolean fp.overSome([(number: number) => true, (number: number) => true]); // $ExpectType (...args: number[]) => boolean } // _.property { interface SampleObject { a: { b: number[]; }; } _.property("a.b[0]"); // $ExpectType (obj: SampleObject) => number _.property(["a", "b", 0]); // $ExpectType (obj: SampleObject) => number _("a.b[0]").property(); // $ExpectType LoDashImplicitWrapper<(obj: SampleObject) => number> _(["a", "b", 0]).property(); // $ExpectType LoDashImplicitWrapper<(obj: SampleObject) => number> _.chain("a.b[0]").property(); // $ExpectType LoDashExplicitWrapper<(obj: SampleObject) => number> _.chain(["a", "b", 0]).property(); // $ExpectType LoDashExplicitWrapper<(obj: SampleObject) => number> fp.property(Symbol.iterator)([]); // $ExpectType any fp.property([Symbol.iterator], []); // $ExpectType any fp.property(1)("abc"); // $ExpectType string } // _.propertyOf { _.propertyOf({}) as (path: _.Many<_.PropertyName>) => any; _({}).propertyOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; _.chain({}).propertyOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; fp.propertyOf(Symbol.iterator)([]); // $ExpectType any fp.propertyOf([Symbol.iterator], []); // $ExpectType any fp.propertyOf(1)("abc"); // $ExpectType string } // _.range // _.rangeRight { _.range(10); // $ExpectType number[] _.range(1, 11); // $ExpectType number[] _.range(0, 30, 5); // $ExpectType number[] _(10).range(); // $ExpectType LoDashImplicitWrapper _(1).range(11); // $ExpectType LoDashImplicitWrapper _(0).range(30, 5); // $ExpectType LoDashImplicitWrapper _.chain(10).range(); // $ExpectType LoDashExplicitWrapper _.chain(1).range(11); // $ExpectType LoDashExplicitWrapper _.chain(0).range(30, 5); // $ExpectType LoDashExplicitWrapper fp.range(1, 11); // $ExpectType number[] fp.range(1)(11); // $ExpectType number[] _.rangeRight(10); // $ExpectType number[] _.rangeRight(1, 11); // $ExpectType number[] _.rangeRight(0, 30, 5); // $ExpectType number[] _(10).rangeRight(); // $ExpectType LoDashImplicitWrapper _(1).rangeRight(11); // $ExpectType LoDashImplicitWrapper _(0).rangeRight(30, 5); // $ExpectType LoDashImplicitWrapper _.chain(10).rangeRight(); // $ExpectType LoDashExplicitWrapper _.chain(1).rangeRight(11); // $ExpectType LoDashExplicitWrapper _.chain(0).rangeRight(30, 5); // $ExpectType LoDashExplicitWrapper fp.rangeRight(1, 11); // $ExpectType number[] fp.rangeRight(1)(11); // $ExpectType number[] _.map([5, 5], _.range); // $ExpectType number[][] _.map([5, 5], _.rangeRight); // $ExpectType number[][] } // _.runInContext { _.runInContext(); // $ExpectType LoDashStatic _.runInContext({}); // $ExpectType LoDashStatic _({}).runInContext(); // $ExpectType LoDashStatic fp.runInContext({}); // $ExpectType LoDashStatic } // _.stubArray { _.stubArray(); // $ExpectType any[] _(anything).stubArray(); // $ExpectType any[] _.chain(anything).stubArray(); // $ExpectType LoDashExplicitWrapper fp.stubArray(); // $ExpectType any[] } // _.stubFalse { _.stubFalse(); // $ExpectType false _(anything).stubFalse(); // $ExpectType false _.chain(anything).stubFalse(); // $ExpectType LoDashExplicitWrapper fp.stubFalse(); // $ExpectType false } // _.stubObject { _.stubObject(); // $ExpectType any _(anything).stubObject(); // $ExpectType any _.chain(anything).stubObject(); // $ExpectType LoDashExplicitWrapper fp.stubObject(); // $ExpectType any } // _.stubString { _.stubString(); // $ExpectType string _(anything).stubString(); // $ExpectType string _.chain(anything).stubString(); // $ExpectType LoDashExplicitWrapper fp.stubString(); // $ExpectType string } // _.stubTrue { _.stubTrue(); // $ExpectType true _(anything).stubTrue(); // $ExpectType true _.chain(anything).stubTrue(); // $ExpectType LoDashExplicitWrapper fp.stubTrue(); // $ExpectType true } // _.times { const iteratee = (num: number): AbcObject => ({ a: 1, b: "", c: true }); _.times(42); // $ExpectType number[] _.times(42, iteratee); // $ExpectType AbcObject[] _(42).times(); // $ExpectType number[] _(42).times(iteratee); // $ExpectType AbcObject[] _.chain(42).times(); // $ExpectType LoDashExplicitWrapper _.chain(42).times(iteratee); // $ExpectType LoDashExplicitWrapper fp.times(iteratee, 42); // $ExpectType AbcObject[] fp.times(iteratee)(42); // $ExpectType AbcObject[] } // _.toPath { _.toPath(1); // $ExpectType string[] _.toPath("a[0].b.c"); // $ExpectType string[] _.toPath(["a", 1]); // $ExpectType string[] _(1).toPath(); // $ExpectType LoDashImplicitWrapper _("a[0].b.c").toPath(); // $ExpectType LoDashImplicitWrapper _(["a", 1]).toPath(); // $ExpectType LoDashImplicitWrapper _.chain(1).toPath(); // $ExpectType LoDashExplicitWrapper _.chain("a[0].b.c").toPath(); // $ExpectType LoDashExplicitWrapper _.chain(["a", 1]).toPath(); // $ExpectType LoDashExplicitWrapper fp.toPath(true); // $ExpectType string[] fp.toPath(1); // $ExpectType string[] fp.toPath("a"); // $ExpectType string[] fp.toPath(["a"]); // $ExpectType string[] fp.toPath({}); // $ExpectType string[] } // _.uniqueId { _.uniqueId(); // $ExpectType string _.uniqueId(""); // $ExpectType string _("").uniqueId(); // $ExpectType string _.chain("").uniqueId(); // $ExpectType LoDashExplicitWrapper fp.uniqueId(""); // $ExpectType string } _.VERSION; // $ExpectType string _.templateSettings; // $ExpectType TemplateSettings // _.partial & _.partialRight { const func0 = (): number => { return 42; }; const func1 = (arg1: number): number => { return arg1 * 2; }; const func2 = (arg1: number, arg2: string): number => { return arg1 * arg2.length; }; const func3 = (arg1: number, arg2: string, arg3: boolean): number => { return arg1 * arg2.length + (arg3 ? 1 : 0); }; // with arity 0 function _.partial(func0); // $ExpectType Function0 // with arity 1 function _.partial(func1, 42); // $ExpectType Function0 _.partial(func1); // $ExpectType Function1 // with arity 2 function _.partial(func2); // $ExpectType Function2 _.partial(func2, 42); // $ExpectType Function1 _.partial(func2, _, "foo"); // $ExpectType Function1 _.partial(func2, _.partial.placeholder, "foo"); // $ExpectType Function1 _.partial(func2, 42, "foo"); // $ExpectType Function0 // with arity 3 function _.partial(func3, 42, _, true); // with arity 0 function _.partialRight(func0); // $ExpectType Function0 // with arity 1 function _.partialRight(func1, 42); // $ExpectType Function0 _.partialRight(func1); // $ExpectType Function1 // with arity 2 function _.partialRight(func2); // $ExpectType Function2 _.partialRight(func2, 42, _); // $ExpectType Function1 _.partialRight(func2, 42, _.partialRight.placeholder); // $ExpectType Function1 _.partialRight(func2, "foo"); // $ExpectType Function1 _.partialRight(func2, 42, "foo"); // $ExpectType Function0 // with arity 3 function _.partialRight(func3, 42, _, true); fp.partial(func1, [42]); // $ExpectType Function0 fp.partial(func1)([42]); // $ExpectType Function0 fp.partial(func2)([fp.partial.placeholder, "foo"]); // $ExpectType Function1 fp.partialRight(func1, [42]); // $ExpectType Function0 fp.partialRight(func1)([42]); // $ExpectType Function0 fp.partialRight(func2)([42, fp.partialRight.placeholder]); // $ExpectType Function1 } // _.stubTrue { _.stubTrue(); // $ExpectType true _("").stubTrue(); // $ExpectType true _.chain("").stubTrue(); // $ExpectType LoDashExplicitWrapper fp.stubTrue(); // $ExpectType true }