interface Date{
completion():any
}
Date.prototype.completion=function(time){
return time<10?'0'+time:time;
};
报错completion does not exist on type date prototype ‘Date’
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你在接口里定义的
completion():any是没有参数的,但是给 prototype.completion 赋值的那个函数是带一个参数的。参考 @aristotll 的代码修改。通过,
Typescript 版本