Skip to content

TypeScript: webp options type missing preset #3747

@pilotso11

Description

@pilotso11

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • [ x ] Running npm install sharp completes without error.
  • [ x ] Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • [ x] I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System:
OS: macOS 13.4.1
CPU: (12) arm64 Apple M2 Pro
Memory: 38.89 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.13.0 - /usr/local/bin/node
npm: 9.3.1 - /usr/local/bin/npm
pnpm: 8.6.11 - /opt/homebrew/bin/pnpm

What are the steps to reproduce?

sharp(src).webp({preset: 'photo').output(dest)

Results in a warning

TS2345: Argument of type '{ quality: number; preset: string; }' is not assignable to parameter of type 'WebpOptions'.   Object literal may only specify known properties, and 'preset' does not exist in type 'WebpOptions'.

What is the expected behaviour?

preset should be accepted. it is missing on the type

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

sharp(src).webp({preset: 'photo').output(dest)

Please provide sample image(s) that help explain this problem

Any image, this is just a problem with the types.

I will submit a pull request shortly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions