0

I'm working on a typescript project that relies extensively on Lodash (using lodash.d.ts). I've implemented a method that uses the _.split function, but this does not seem to be implemented just yet. (Ref. the .ts file, where it's included in the 'Later' section).

Is there a way for me to work around this, so it doesn't stop my build? (Building from Visual Studio and sometimes as a Grunt task).

Here's the error:

TS2339 Property 'split' does not exist on type 'LoDashStatic'

As a contextual reference, here's the code:

private parseString(text: string) {
    const arr = _.map(_.split(text, ","),
        (x: string) => {
            let index = x.indexOf(":");
            return [
                x.substring(0, index),
                _.trim(x.substring(index + 1), "()")
            ];
        });

    console.log(_.fromPairs(arr));

    return _.fromPairs(arr);
}

The code works, however it's just annoying that the build stops as a result of this.

Nicklas Pouey-Winger
  • 3,023
  • 6
  • 43
  • 75

1 Answers1

0

Resolved this the 'easy' way, using native Javascript string.split() method.

Nicklas Pouey-Winger
  • 3,023
  • 6
  • 43
  • 75