interface String {
logit(): void;
}
String.prototype.logit = function () {
console.log(this);
}
let a = "string";
a.logit();
typescript 动态给class添加方法
最新推荐文章于 2025-11-02 23:11:45 发布
interface String {
logit(): void;
}
String.prototype.logit = function () {
console.log(this);
}
let a = "string";
a.logit();
2530
1876

被折叠的 条评论
为什么被折叠?