Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

typescript 中修改 Date 的 prototype,添加了 export 语句后出现了问题。

$
0
0

我在尝试给 Date 添加一个方法

interface Date {
  f(): string
}
Date.prototype.f = function(){
  return 'hello';
}
console.log(new Date().f());

这样是没有问题的。

可是导出就出现了问题,也就是添加一行 export {} 之后,就编译不了了。

TIM截图20190812171924.png


Viewing all articles
Browse latest Browse all 14821

Trending Articles