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

types: added missing types for OverlayOptions #4048

Merged
merged 3 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,14 @@ declare namespace sharp {
tile?: boolean | undefined;
/** Set to true to avoid premultipling the image below. Equivalent to the --premultiplied vips option. */
premultiplied?: boolean | undefined;
/** number representing the DPI for vector overlay image. (optional, default 72)*/
density?: number | undefined;
/** Set to true to read all frames/pages of an animated image. (optional, default false) */
animated?: boolean | undefined;
/** see sharp() constructor, (optional, default 'warning') */
failOn?: FailOnOptions | undefined;
/** see sharp() constructor, (optional, default 268402689) */
limitInputPixels?: number | boolean | undefined;
}

interface TileOptions {
Expand Down
21 changes: 21 additions & 0 deletions test/types/sharp.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,3 +680,24 @@ sharp(input)
.keepIccProfile()
.withIccProfile('filename')
.withIccProfile('filename', { attach: false });

// Added missing types for OverlayOptions
// https://github.com/lovell/sharp/pull/4048
sharp(input).composite([
{
input: 'image.gif',
animated: true,
limitInputPixels: 536805378,
density: 144,
failOn: "warning"
}
])
sharp(input).composite([
{
input: 'image.png',
animated: false,
limitInputPixels: 178935126,
density: 72,
failOn: "truncated"
}
])