Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/utils/group-in/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ type Indicator = Nullary | Unary | Binary;
* var out = groupIn( obj, indicator );
* // e.g., returns { 'b': [ 'beep', 'boop', 'bar' ], 'f': [ 'foo' ] }
*/
declare function groupIn( obj: any, indicator: Indicator ): any;
declare function groupIn<T, K>(obj: T, indicator: (v: T) => K): { [key: string]: K[] };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These declarations do not look correct. The values returned by the indicator function are, TMK, not what is in the output arrays.

Furthermore, this PR should seek to enhance the existing Indicator definition, not simply ignore it as you have done here.



/**
* Groups an object's own and inherited property values according to an indicator function.
Expand Down Expand Up @@ -181,8 +182,7 @@ declare function groupIn( obj: any, indicator: Indicator ): any;
* var out = groupIn( obj, opts, indicator );
* // e.g., returns { 'b': [ [ 'a', 'beep' ], [ 'b', 'boop' ], [ 'd', 'bar' ] ], 'f': [ [ 'c', 'foo' ] ] }
*/
declare function groupIn( obj: any, options: Options, indicator: Indicator ): any;

declare function groupIn<T, K>(obj: T, options: Options, indicator: (v: T) => K): any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to avoid any, you could use overloads based on the returns option value.


// EXPORTS //

Expand Down