From c0ec19e2d0fe3060b7dd490f74115a4e39840ba2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 28 Jun 2017 09:50:28 -0700 Subject: [PATCH] Fix underscore tests for TS 2.4 A test in underscore mistakenly used the truthiness of _.identity as a predicate for _.every, even though the predicate is supposed to return boolean. The new code wraps _.identity in an arrow and prefixes a `!!` to coerce truthy values to true. --- types/underscore/underscore-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 11dcf477a0..f72bb3ca68 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -156,7 +156,7 @@ _.where(listOfPlays, { author: "Shakespeare", year: 1611 }); var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); -_.every([true, 1, null, 'yes'], _.identity); +_.every([true, 1, null, 'yes'], x => !!_.identity(x)); _.any([null, 0, 'yes', false]);