节点模块在其gm
文档中提到您可以使用.prototype
语法来扩展类功能。
https://github.com/aheckmann/gm/wiki/Extending-gm
var gm = require("gm")
gm.prototype.sepia = function(){
this.modulate(115, 0, 100).colorize(7, 21, 50)
return this
}
我想知道是否有一种使用 TypeScript 的方法来使用类语法来扩展它?
当我尝试以明显的方式执行此操作时,出现此错误:
类型 'typeof import("/Users/thomasreggi/Desktop/interactive-stitch/node_modules/@types/gm/index.d.ts")' 不是构造函数 type.ts(2507)
import gm from 'gm'
class Magick extends gm {}