DefinitelyTyped / DefinitelyTyped/DefinitelyTyped

Typescript description error about Image attribute "fromURL" function

Open
#67,299 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
51.4k
Forks
30.4k
Avg merge
3d 21h
Merged PRs (30d)
108

Description

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);
  };

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open types/fabric/fabric-impl.d.ts around line 2600 and compare the Image.fromURL declaration comment with the fabricjs 4.2.0 behavior shown in the issue. Update the callback description to account for both callback parameters, then verify the declaration remains consistent with the referenced implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.