-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add types for Object.groupBy() and Map.groupBy() (#56805)
Co-authored-by: Nick McCurdy <nick@nickmccurdy.com> Co-authored-by: Karl Horky <karl.horky@gmail.com> Co-authored-by: Niklas Mollenhauer <nikeee@outlook.com>
- Loading branch information
1 parent
67b644e
commit fbf908b
Showing
37 changed files
with
552 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
interface MapConstructor { | ||
/** | ||
* Groups members of an iterable according to the return value of the passed callback. | ||
* @param items An iterable. | ||
* @param keySelector A callback which will be invoked for each item in items. | ||
*/ | ||
groupBy<K, T>( | ||
items: Iterable<T>, | ||
keySelector: (item: T, index: number) => K, | ||
): Map<K, T[]>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
interface ObjectConstructor { | ||
/** | ||
* Groups members of an iterable according to the return value of the passed callback. | ||
* @param items An iterable. | ||
* @param keySelector A callback which will be invoked for each item in items. | ||
*/ | ||
groupBy<K extends PropertyKey, T>( | ||
items: Iterable<T>, | ||
keySelector: (item: T, index: number) => K, | ||
): Partial<Record<K, T[]>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...onfig/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...rence/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.