mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge pull request #33483 from DefinitelyTyped/revert-33095-patch-2
Revert "[underscore] Deduce return type from key in _.pluck"
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import i = require("icepick");
|
||||
import * as _ from 'underscore';
|
||||
|
||||
"use strict"; // so attempted modifications of frozen objects will throw errors
|
||||
|
||||
@@ -145,13 +146,15 @@ class Foo {}
|
||||
{
|
||||
i.map(function(v) { return v * 2 }, [1, 2, 3]); // [2, 4, 6]
|
||||
|
||||
i.filter(function(v: number) { return v % 2 === 0; }, [1, 2, 3]); // [1, 3]
|
||||
var removeEvens = _.partial(i.filter, function(v: number) { return v % 2; });
|
||||
|
||||
removeEvens([1, 2, 3]); // [1, 3]
|
||||
}
|
||||
{
|
||||
var arr = i.freeze([{ a: 1 }, { b: 2 }]);
|
||||
|
||||
//ECMAScript 2015
|
||||
//arr.find(function(item) { return item.b != null; }); // {b: 2}
|
||||
//arr.find(function(item) { return item.b != null; }); // {b: 2}
|
||||
}
|
||||
|
||||
// chain(coll) - not defined
|
||||
|
||||
Vendored
-1
@@ -2,7 +2,6 @@
|
||||
// Project: https://github.com/epeli/underscore.string
|
||||
// Definitions by: Ry Racherbaumer <https://github.com/rygine>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as _ from 'underscore';
|
||||
|
||||
|
||||
Vendored
+2
-3
@@ -2,7 +2,6 @@
|
||||
// Project: http://underscorejs.org/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>, Josh Baldwin <https://github.com/jbaldwin>, Christopher Currens <https://github.com/ccurrens>, Cassey Lottman <https://github.com/clottman>, Ard Timmerman <https://github.com/confususs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
declare var _: _.UnderscoreStatic;
|
||||
export = _;
|
||||
@@ -554,9 +553,9 @@ declare module _ {
|
||||
* @param propertyName The property to look for on each element within `list`.
|
||||
* @return The list of elements within `list` that have the property `propertyName`.
|
||||
**/
|
||||
pluck<T extends {}, K extends keyof T>(
|
||||
pluck<T extends {}>(
|
||||
list: _.List<T>,
|
||||
propertyName: K): T[K][];
|
||||
propertyName: string): any[];
|
||||
|
||||
/**
|
||||
* Returns the maximum value in list.
|
||||
|
||||
@@ -520,7 +520,7 @@ function chain_tests() {
|
||||
let numberObjects = [{property: 'odd', value: 1}, {property: 'even', value: 2}, {property: 'even', value: 0}];
|
||||
let evenAndOddGroupedNumbers = _.chain(numberObjects)
|
||||
.groupBy('property')
|
||||
.mapObject((objects) => _.pluck(objects, 'value'))
|
||||
.mapObject((objects: any) => _.pluck(objects, 'value'))
|
||||
.value(); // { odd: [1], even: [0, 2] }
|
||||
|
||||
var matrixOfString : string[][] = _.chain({'foo' : '1', 'bar': '1'})
|
||||
|
||||
Reference in New Issue
Block a user