知道为什么这不起作用或如何扩展持续时间接口以支持格式功能?
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)
我收到"持续时间"类型中"格式"不存在的错误