typescript - 有没有更好的方法将 Moment 与 TypeScript(Visual Studio 2019 红色波浪线)一起使用?
问题描述
现在看起来我们必须输入很多:
nextTimePeriod(momentString: string) {
this.today = moment(this.today).add(1, <moment.unitOfTime.DurationConstructor>(momentString + 's'));
this.startDate = moment(this.today).startOf(<moment.unitOfTime.StartOf>momentString);
}
解决方案
推荐阅读
- android - 带有 ConstraintLayout 的两列
- google-apps-script - 遍历谷歌表格中的单元格并创建具有特定格式的字符串
- sql-server - 无法使用 PySpark 插入 SQL,但可以在 SQL 中使用
- linkedin - 是否可以使用 Linked API v2 获取职位列表?
- css - scss 使用 laravel-mix 编译成功,但在浏览器中没有变化
- c# - Vector3.Lerp() 末尾的“分数”值是多少?统一声明
- docker - Docker推送“拒绝:请求的资源访问被拒绝”
- javascript - 如何使用 Javascript 将查询参数附加到我的 URL?
- javascript - 使用 React 和 Redux 制作确认模式
- c - 我需要/可以在 C 中释放 void 指针吗?