mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
Added TResult generic to chainable _(...).pluck methods
This is needed because there is no way to cast the output in the middle of the chain.
This is not be done on _.pluck() methods because T cannot be inferred. In other words, this:
<number>_.pluck(objectArray, 'id');
or this:
var id: number = _.pluck(objectArray, 'id');
is cleaner than this:
_.pluck<IMyObjectInterface, number>(objectArray, 'id');
This commit is contained in:
Vendored
+4
-4
@@ -3548,16 +3548,16 @@ declare module _ {
|
||||
/**
|
||||
* @see _.pluck
|
||||
**/
|
||||
pluck<T extends {}>(
|
||||
property: string): LoDashArrayWrapper<any>;
|
||||
pluck<TResult>(
|
||||
property: string): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.pluck
|
||||
**/
|
||||
pluck<T extends {}>(
|
||||
property: string): LoDashArrayWrapper<any>;
|
||||
pluck<TResult>(
|
||||
property: string): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.reduce
|
||||
|
||||
Reference in New Issue
Block a user