Lodash.d.ts 中缺少 _.split 的接口声明

Missing interface declaration for _.split in Lodash.d.ts

我正在开发一个广泛依赖 Lodash 的打字稿项目(使用 lodash.d.ts)。我实现了一个使用 _.split 函数的方法,但这似乎还没有实现。 (参考 .ts 文件,它包含在 'Later' 部分)。

有没有办法解决这个问题,使其不会停止我的构建? (从 Visual Studio 构建,有时作为 Grunt 任务)。

这是错误:

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

作为上下文参考,代码如下:

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);
}

该代码有效,但令人恼火的是构建因此而停止。

使用本机 Javascript string.split() 方法以 'easy' 方式解决了这个问题。