Lin*_*son 1 javascript momentjs typescript angular
导入 MomentJS 导致以下错误:
ERROR in [...] Cannot invoke an expression whose type lacks a call signature. Type 'typeof moment' has no compatible call signatures.
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?
最新版本的 MomentJS 现在已经定义了类型。在没有外部类型的情况下重新安装 MomentJS。您还应该避免名称空间样式的导入,因为此类导入无法调用或构造,并且会导致运行时失败。
要走的路是传统的进口:
import moment from 'moment';
| 归档时间: |
|
| 查看次数: |
2660 次 |
| 最近记录: |