mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-12 22:36:10 +08:00
Underscore.js: Updated chained calls to first() so that they return a _ChainSingle<T> instead of _Chain<T>. This causes a future call to value() to return a single T rather than an array of T which matches underscore's behavior.
This commit is contained in:
@@ -328,4 +328,8 @@ function chain_tests() {
|
||||
.flatten()
|
||||
.find(num => num % 2 == 0)
|
||||
.value();
|
||||
|
||||
var firstVal: number = _.chain([1, 2, 3])
|
||||
.first()
|
||||
.value();
|
||||
}
|
||||
|
||||
2
underscore/underscore.d.ts
vendored
2
underscore/underscore.d.ts
vendored
@@ -2620,7 +2620,7 @@ interface _Chain<T> {
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.first
|
||||
**/
|
||||
first(): _Chain<T>;
|
||||
first(): _ChainSingle<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
|
||||
Reference in New Issue
Block a user