diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index fe969f110b..172000d6b8 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -13317,6 +13317,48 @@ declare namespace _ { toPlainObject(): LoDashImplicitObjectWrapper; } + //_.toFinite + interface LoDashStatic { + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + toFinite(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toFinite + */ + toFinite(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toFinite + */ + toFinite(): LoDashExplicitWrapper; + } + //_.toInteger interface LoDashStatic { /** diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 9735d1c417..4721e9381d 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -8014,13 +8014,36 @@ namespace TestToPlainObject { } } +// _.toFinite +namespace TestToFinite { + { + let result: number; + result = _.toFinite(true); + result = _.toFinite(1); + result = _.toFinite('3.2'); + result = _.toFinite([]); + result = _.toFinite({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toFinite(); + result = _(1).toFinite(); + result = _('3.2').toFinite(); + result = _([1]).toFinite(); + result = _([]).toFinite(); + result = _({}).toFinite(); + } +} + // _.toInteger namespace TestToInteger { { let result: number; result = _.toInteger(true); result = _.toInteger(1); - result = _.toInteger('a'); + result = _.toInteger('3.2'); result = _.toInteger([]); result = _.toInteger({}); } diff --git a/types/lodash/toFinite/index.d.ts b/types/lodash/toFinite/index.d.ts new file mode 100644 index 0000000000..f0317af649 --- /dev/null +++ b/types/lodash/toFinite/index.d.ts @@ -0,0 +1,2 @@ +import { toFinite } from "../index"; +export = toFinite; diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 55cecd6166..e1f7296a79 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -248,6 +248,7 @@ "thru/index.d.ts", "times/index.d.ts", "toArray/index.d.ts", + "toFinite/index.d.ts", "toInteger/index.d.ts", "toLength/index.d.ts", "toLower/index.d.ts",