Add most components of ListIteratee to Collection.orderBy (#35667)

[PropertyName, any] breaks contextual typing of ListIterator, so I left
it out.
This commit is contained in:
Nathan Shively-Sanders
2019-05-23 08:24:48 -07:00
committed by GitHub
parent cb1b8a1884
commit 674a7033d6
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -1342,7 +1342,7 @@ declare module "../index" {
/**
* @see _.orderBy
*/
orderBy(iteratees?: Many<ListIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): Collection<T>;
orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialDeep<T>>, orders?: Many<boolean|"asc"|"desc">): Collection<T>;
}
interface Object<T> {
/**
@@ -1354,7 +1354,7 @@ declare module "../index" {
/**
* @see _.orderBy
*/
orderBy(iteratees?: Many<ListIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T>;
orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialDeep<T>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T>;
}
interface ObjectChain<T> {
/**
+2 -2
View File
@@ -3161,7 +3161,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType CollectionChain<number>
_.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(list, [(value) => 1, 'third', (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[]
@@ -3177,7 +3177,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType CollectionChain<number>
_.chain(list).orderBy((value) => 1); // $ExpectType CollectionChain<AbcObject>
_.chain(list).orderBy((value) => 1, true); // $ExpectType CollectionChain<AbcObject>
_.chain(list).orderBy([(value) => 1, (value) => 2], true); // $ExpectType CollectionChain<AbcObject>
_.chain(list).orderBy([(value) => 1, 'third', (value) => 2], true); // $ExpectType CollectionChain<AbcObject>
_.chain(dictionary).orderBy((value) => 1); // $ExpectType CollectionChain<AbcObject>
_.chain(dictionary).orderBy((value) => 1, true); // $ExpectType CollectionChain<AbcObject>
_.chain(numericDictionary).orderBy((value) => 1); // $ExpectType CollectionChain<AbcObject>