DefinitelyTyped icon indicating copy to clipboard operation
DefinitelyTyped copied to clipboard

Typescript description error about Image attribute "fromURL" function

Open makerhou opened this issue 2 years ago • 1 comments

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6dbc51f204ea530bee3c2e452ba28ebf0cf31336/types/fabric/fabric-impl.d.ts#L2600

The attribute description of the image prototype "fromURL" is wrong. The "fromUrl" callback has two parameters "image" and "error" The fabricjs(4.2.0) Image.formURL

/**
   * Creates an instance of fabric.Image from an URL string
   * @static
   * @param {String} url URL to create an image from
   * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument). Second argument is a boolean indicating if an error occured or not.
   * @param {Object} [imgOptions] Options object
   */
  fabric.Image.fromURL = function(url, callback, imgOptions) {
    fabric.util.loadImage(url, function(img, isError) {
      callback && callback(new fabric.Image(img, imgOptions), isError);
    }, null, imgOptions && imgOptions.crossOrigin);
  };

makerhou avatar Nov 03 '23 09:11 makerhou

This is still missing. Not the only place where this happens, in loadImage, for example, isError is not defined either.

mfgea avatar May 03 '24 03:05 mfgea