错误TS2307:在moment-date-adapter.d.ts中找不到模块“ moment”

And*_*ton 2 material-design angular-material angular angular6

使用Angular 6,我在使用材料力矩适配器时遇到了麻烦。在我的moment-date-adapter.d.ts文件中,当尝试从中导入{Moment}时,在导入语句中显示“找不到'module'”

node_modules/@angular/material-moment-adapter/typings/adapter/moment-date-adapter.d.ts。

我的tsconfig.json如下:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ] 
  }
}
Run Code Online (Sandbox Code Playgroud)

我的进口声明很简单

import { Moment } from 'moment';
Run Code Online (Sandbox Code Playgroud)

从我的moment-date-adapter.d.ts文件中。

任何帮助,将不胜感激。

小智 5

安装@ types / moment作为开发人员依赖项为我解决了它。