相关疑难解决方法(0)

moment-duration-format.d.ts定义不扩展矩量模块

知道为什么这不起作用或如何扩展持续时间接口以支持格式功能?

declare module 'moment' {
     interface Duration {
       format(template: string, precision?: string, settings?: any): string;
     }

}
Run Code Online (Sandbox Code Playgroud)

当用作:

moment.duration(minutes, 'minutes').format('mm');
Run Code Online (Sandbox Code Playgroud)

我收到"持续时间"类型中"格式"不存在的错误

javascript momentjs typescript

6
推荐指数
2
解决办法
3809
查看次数

标签 统计

javascript ×1

momentjs ×1

typescript ×1