JsDoc Typing In FabricJS

14 Views Asked by At

I'm having trouble with some typing errors when calling removeWithUpdate on the response to canvas.getActiveObject()

canvas.getActiveObject().removeWithUpdate(obj)

The error is Property 'removeWithUpdate' does not exist on type 'Object'.

The code works, I may just do a @ts-ignore here, but what are some other options?

I'm using JsDoc loosely and in key complexity spots, but I am running production build through the ts-checker in webpack.

Casting works fine, but in that case I'd rather just do an @ts-ignore:

 /** @type {{removeWithUpdate: function}} */
            const active = /** @type {*} */ (this.canvas.getActiveObject())
            active.removeWithUpdate(obj)
0

There are 0 best solutions below