I have an array of strings that were broken like this:
var searchValue = "600-800, 123, 180";
var groups = searchValue.split(","); // => ["600-800", " 123", " 180"]
(therefore there are potentially spaces around the elements) and I would like to remove the spaces. I know what I can use Array.prototype.mapwith String.prototype.trim, but I would like the solution to specifically use Lodash.
According to the documents , I can say: _.map([' foo ', ' bar '], _.trim);and he will return ['foo', 'bar'], which is string[].
However, TypeScript barks at me. This is what I see in my editor.

I am running TypeScript 2.3.2 and Lodash 4.17.4
Oddly enough, if I say:
var values:string[] = _.map([' foo ', ' bar '], String.prototype.trim);
TypeScript errors go away, but I get the following runtime error when searchValueempty and groupsreturns [""]:
TypeError: String.prototype.trim null undefined
, :
var values:string[] = _.map(_.filter(groups, group => group.indexOf("-") === -1), _.trim);
var values:string[] = _.map(_.filter(groups, function (group) { return group.indexOf("-") === -1; }), _.trim);
var values:string[] = _.map<string, (string?: string, chars?: string) => string>(_.filter(groups, function (group) { return group.indexOf("-") === -1 }), _.trim);
var values:string[] = _.map<string, (string?: string, chars?: string) => string[]>(_.filter(groups, function (group) { return group.indexOf("-") === -1 }), _.trim);
var values:string[] = _.map<string, (string: string, chars: string) => string>(_.filter(groups, function (group) { return group.indexOf("-") === -1 }), _.trim);
var values:string[] = _.map<string, (string: string) => string>(_.filter(groups, function (group) { return group.indexOf("-") === -1 }), _.trim);
. . -, Lodash/ TypeScript?