【发布时间】:2018-01-04 20:52:19
【问题描述】:
我在 Angular 4 项目中使用 typescript,并希望使用 moment-precise-range-plugin。
我在https://momentjs.com/docs/#/use-it/typescript/ 之后安装了moment,但我想添加精确范围插件http://momentjs.com/docs/#/plugins/preciserange/。
为精确范围插件安装 Node.js 位于 https://codebox.org.uk/pages/moment-date-range-plugin 并指定 require('moment-precise-range-plugin');,但没有安装 Typescript。
我试过import { Moment } from 'moment-precise-range-plugin';,但得到以下打字稿错误
Could not find a declaration file for module 'moment-precise-range-plugin'. 'c:/Users/[UserName]/app/node_modules/moment-precise-range-plugin/moment-precise-range.js' implicitly has an 'any' type. Try npm install @types/moment-precise-range-plugin if it exists or add a new declaration (.d.ts) file containing declare module 'moment-precise-range-plugin';'
非常欢迎任何想法!
【问题讨论】:
标签: javascript angular typescript ecmascript-6 momentjs