From 83b2933ba7872b4d8645f263f36f505af11a5090 Mon Sep 17 00:00:00 2001 From: Oliver Speir Date: Tue, 2 Apr 2024 03:09:04 -0600 Subject: [PATCH 1/4] move format to ImageSharedProps --- packages/astro/src/assets/types.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/astro/src/assets/types.ts b/packages/astro/src/assets/types.ts index 29cf1ef9ee8a..814cde4b0122 100644 --- a/packages/astro/src/assets/types.ts +++ b/packages/astro/src/assets/types.ts @@ -118,6 +118,15 @@ type ImageSharedProps = T & { * ``` */ height?: number | `${number}`; + /** + * Desired output format for the image. Defaults to `webp`. + * + * **Example**: + * ```astro + * ... + * ``` + */ + format?: ImageOutputFormat; } & ( | { /** @@ -153,15 +162,6 @@ export type LocalImageProps = ImageSharedProps & { * ``` */ src: ImageMetadata | Promise<{ default: ImageMetadata }>; - /** - * Desired output format for the image. Defaults to `webp`. - * - * **Example**: - * ```astro - * ... - * ``` - */ - format?: ImageOutputFormat; /** * Desired quality for the image. Value can either be a preset such as `low` or `high`, or a numeric value from 0 to 100. * From a2c7477a85daf156eea0f4466a31c15ae8d8f064 Mon Sep 17 00:00:00 2001 From: Oliver Speir Date: Tue, 2 Apr 2024 03:17:01 -0600 Subject: [PATCH 2/4] add changeset --- .changeset/lovely-trees-wait.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lovely-trees-wait.md diff --git a/.changeset/lovely-trees-wait.md b/.changeset/lovely-trees-wait.md new file mode 100644 index 000000000000..6d76f69be107 --- /dev/null +++ b/.changeset/lovely-trees-wait.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Moves format option from LocalImageProps to ImageSharedProps to solve type error when using format with remote images From 81cd1b47568d300717a861a9e841e36dffa17235 Mon Sep 17 00:00:00 2001 From: Oliver Speir Date: Tue, 2 Apr 2024 04:53:43 -0600 Subject: [PATCH 3/4] move quality to shared --- packages/astro/src/assets/types.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/astro/src/assets/types.ts b/packages/astro/src/assets/types.ts index 814cde4b0122..89610b05b05c 100644 --- a/packages/astro/src/assets/types.ts +++ b/packages/astro/src/assets/types.ts @@ -127,6 +127,19 @@ type ImageSharedProps = T & { * ``` */ format?: ImageOutputFormat; + /** + * Desired quality for the image. Value can either be a preset such as `low` or `high`, or a numeric value from 0 to 100. + * + * The perceptual quality of the output image is service-specific. + * For instance, a certain service might decide that `high` results in a very beautiful image, but another could choose for it to be at best passable. + * + * **Example**: + * ```astro + * ... + * ... + * ``` + */ + quality?: ImageQuality; } & ( | { /** @@ -162,19 +175,6 @@ export type LocalImageProps = ImageSharedProps & { * ``` */ src: ImageMetadata | Promise<{ default: ImageMetadata }>; - /** - * Desired quality for the image. Value can either be a preset such as `low` or `high`, or a numeric value from 0 to 100. - * - * The perceptual quality of the output image is service-specific. - * For instance, a certain service might decide that `high` results in a very beautiful image, but another could choose for it to be at best passable. - * - * **Example**: - * ```astro - * ... - * ... - * ``` - */ - quality?: ImageQuality; }; export type RemoteImageProps = From 46cd7bf603387e6426b80c91fb3d498f54261db4 Mon Sep 17 00:00:00 2001 From: Oliver Speir <115520730+OliverSpeir@users.noreply.github.com> Date: Tue, 2 Apr 2024 07:34:53 -0600 Subject: [PATCH 4/4] Update lovely-trees-wait.md Co-authored-by: Florian Lefebvre --- .changeset/lovely-trees-wait.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/lovely-trees-wait.md b/.changeset/lovely-trees-wait.md index 6d76f69be107..2a7511d8a066 100644 --- a/.changeset/lovely-trees-wait.md +++ b/.changeset/lovely-trees-wait.md @@ -2,4 +2,4 @@ "astro": patch --- -Moves format option from LocalImageProps to ImageSharedProps to solve type error when using format with remote images +Fixes typing issues when using `format` and `quality` options with remote images