【问题标题】:Angular2 : Lodash working but triggers a Typescript errorAngular2:Lodash 工作但触发 Typescript 错误
【发布时间】:2016-06-01 06:49:32
【问题描述】:

我确实尝试在我的 angular2 项目中导入 lodash。它工作正常,但我的日志中一直出现以下错误:

TS2307 Cannot find module 'lodash'.
[error] import * as _ from "lodash"

但是,我使用它没有任何问题。我必须更改任何 tsconfig 以防止这种情况发生吗?

【问题讨论】:

    标签: typescript angular lodash


    【解决方案1】:

    您需要向 TypeScript 声明外部模块才能为您进行类型检查。

    快速修复

    typings install lodash --global --save

    【讨论】:

    猜你喜欢
    • 2017-10-18
    • 2017-06-27
    • 1970-01-01
    • 2016-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-14
    • 1970-01-01
    相关资源
    最近更新 更多