Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript: Compile error when using getBufferAsync(Jimp.AUTO) #878

Closed
msdtim opened this issue Apr 19, 2020 · 2 comments · Fixed by #1094
Closed

Typescript: Compile error when using getBufferAsync(Jimp.AUTO) #878

msdtim opened this issue Apr 19, 2020 · 2 comments · Fixed by #1094
Labels
released This issue/pull request has been released.

Comments

@msdtim
Copy link

msdtim commented Apr 19, 2020

Expected Behavior

getBufferAsync(Jimp.AUTO) should be allowed as per package README

If Jimp.AUTO is passed as the MIME type then the original MIME type for the image (or "image/png") will be used. Alternatively, image.getMIME() will return the original MIME type of the image (or "image/png").

Current Behavior

VSCode will report problem and tsc will throw compile error

Failure Information (for bugs)

Compiler output:

error TS2345: Argument of type '-1' is not assignable to parameter of type 'string'.

Steps to Reproduce

npm install -g typescript
npm install --save jimp
npm install @types/node --save-dev
tsc -p tsconfig.json

Context

In the jimp.d.ts, these functions should be updated to allow number type for mime parameter.

 getBase64(mime: string, cb: GenericCallback<string, any, this>): this;
 getBase64Async(mime: string): Promise<string>;
 getBuffer(mime: string, cb: GenericCallback<Buffer>): this;
 getBufferAsync(mime: string): Promise<Buffer>;
  • Jimp Version: 0.10.2
  • Operating System: macOS 10.14.6
  • Node version: 12.16.1

Failure Logs

hipstersmoothie pushed a commit that referenced this issue Feb 4, 2023
…1094)

add type AUTO since getBase64 and getBase64Async support Jimp.AUTO.

fix #878
@hipstersmoothie
Copy link
Collaborator

🚀 Issue was released in v0.17.7 🚀

@hipstersmoothie hipstersmoothie added the released This issue/pull request has been released. label Feb 4, 2023
@hipstersmoothie
Copy link
Collaborator

🚀 Issue was released in v0.17.7 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants