From 9cb7452abb970f4df7548b97587187b3b5b05123 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 10 Dec 2015 06:20:45 +0500 Subject: [PATCH] lodash: signatures of _.isBoolean have been changed --- lodash/lodash-tests.ts | 41 +++++++++++++++++++++++++++-------------- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c409e2621..e45f03a09 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5337,20 +5337,33 @@ result = _({}).isArray(); } // _.isBoolean -result = _.isBoolean(any); -result = _(1).isBoolean(); -result = _([]).isBoolean(); -result = _({}).isBoolean(); -{ - let value: number[]|boolean = [1, 3, 5]; - if (_.isBoolean(value)) { - let b: boolean = value; - // compile error - // let length: number = value.length; - } else { - let length: number = value.length; - // compile error - // let b: boolean = value; +module TestIsBoolean { + { + let value: number|boolean; + + if (_.isBoolean(value)) { + let result: boolean = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isBoolean(any); + result = _(1).isBoolean(); + result = _([]).isBoolean(); + result = _({}).isBoolean(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isBoolean(); + result = _([]).chain().isBoolean(); + result = _({}).chain().isBoolean(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 253107c7f..04abeb490 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9212,9 +9212,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a boolean primitive or object. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. - **/ + */ isBoolean(value?: any): value is boolean; } @@ -9225,6 +9226,13 @@ declare module _ { isBoolean(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): LoDashExplicitWrapper; + } + //_.isDate interface LoDashStatic { /**