【发布时间】:2017-08-18 21:43:24
【问题描述】:
我最近开始了一个新的打字稿项目,现在我想利用矩范围。我已经安装了 moment-range 和 @typings/moment-range 并将这些行添加到我的文档顶部:
import * as moment from 'moment';
import { DateRange } from 'moment-range';
但是,我仍然遇到此错误:Property 'range' does not exist on type 'typeof moment'
这是我的 tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": false,
"noEmitOnError": true,
"lib": [
"es6",
"dom",
"es2015.iterable"
],
"baseUrl": ".",
"paths": {
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
]
}
},
"exclude": [
"node_modules",
"platforms",
"**/*.aot.ts"
]
}
我错过了什么步骤?
另外,有没有办法全局包含矩范围类型,这样我就不必在每个文件中都这样做?
【问题讨论】:
标签: typescript