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

withMetadata TypeScript definition is missing boolean type #3822

Closed
3 tasks done
uhthomas opened this issue Oct 11, 2023 · 2 comments · Fixed by #3823
Closed
3 tasks done

withMetadata TypeScript definition is missing boolean type #3822

uhthomas opened this issue Oct 11, 2023 · 2 comments · Fixed by #3823

Comments

@uhthomas
Copy link
Contributor

uhthomas commented Oct 11, 2023

Possible bug

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

  • Running npm install sharp completes without error.
  • 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?

  • 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?

What are the steps to reproduce?

The withMetadata implementation checks for a boolean and therefore implies it is valid to provide one as an argument. The TypeScript definition however does not indicate this.

src/infra/repositories/media.repository.ts:35:21 - error TS2559: Type 'false' has no properties in common with type 'WriteableMetadata'.

What is the expected behaviour?

withMetadata(withMetadata?: boolean | WriteableMetadata): Sharp;

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

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

@lovell
Copy link
Owner

lovell commented Nov 14, 2023

It looks like the work for #3824 may supersede this fix as parts of the withMetadata() API are being deprecated and most scenarios should switch to use the (proposed) keepX() methods instead.

@lovell
Copy link
Owner

lovell commented Nov 29, 2023

v0.33.0 is now available.

@lovell lovell closed this as completed Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants