summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Oliver Speir <115520730+OliverSpeir@users.noreply.github.com> 2024-04-02 14:24:02 -0600
committerGravatar GitHub <noreply@github.com> 2024-04-02 16:24:02 -0400
commit4f5dc14f315eba7ea6ec5cc8e5dacb0cb81288dd (patch)
tree440692992ceb7c3b5a5c9dba27176111ec6d8962
parentc3916b5206f7e99c8be301f12881931ea4f61b01 (diff)
downloadastro-4f5dc14f315eba7ea6ec5cc8e5dacb0cb81288dd.tar.gz
astro-4f5dc14f315eba7ea6ec5cc8e5dacb0cb81288dd.tar.zst
astro-4f5dc14f315eba7ea6ec5cc8e5dacb0cb81288dd.zip
Move format option from LocalImageProps to ImageSharedProps (#10642)
* move format to ImageSharedProps * add changeset * move quality to shared * Update lovely-trees-wait.md Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> --------- Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
-rw-r--r--.changeset/lovely-trees-wait.md5
-rw-r--r--packages/astro/src/assets/types.ts44
2 files changed, 27 insertions, 22 deletions
diff --git a/.changeset/lovely-trees-wait.md b/.changeset/lovely-trees-wait.md
new file mode 100644
index 000000000..2a7511d8a
--- /dev/null
+++ b/.changeset/lovely-trees-wait.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Fixes typing issues when using `format` and `quality` options with remote images
diff --git a/packages/astro/src/assets/types.ts b/packages/astro/src/assets/types.ts
index 29cf1ef9e..89610b05b 100644
--- a/packages/astro/src/assets/types.ts
+++ b/packages/astro/src/assets/types.ts
@@ -118,6 +118,28 @@ type ImageSharedProps<T> = T & {
* ```
*/
height?: number | `${number}`;
+ /**
+ * Desired output format for the image. Defaults to `webp`.
+ *
+ * **Example**:
+ * ```astro
+ * <Image src={...} format="avif" alt="..." />
+ * ```
+ */
+ 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
+ * <Image src={...} quality='high' alt="..." />
+ * <Image src={...} quality={300} alt="..." />
+ * ```
+ */
+ quality?: ImageQuality;
} & (
| {
/**
@@ -153,28 +175,6 @@ export type LocalImageProps<T> = ImageSharedProps<T> & {
* ```
*/
src: ImageMetadata | Promise<{ default: ImageMetadata }>;
- /**
- * Desired output format for the image. Defaults to `webp`.
- *
- * **Example**:
- * ```astro
- * <Image src={...} format="avif" alt="..." />
- * ```
- */
- 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
- * <Image src={...} quality='high' alt="..." />
- * <Image src={...} quality={300} alt="..." />
- * ```
- */
- quality?: ImageQuality;
};
export type RemoteImageProps<T> =