Skip to content

Commit

Permalink
Move format option from LocalImageProps to ImageSharedProps (#10642)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
OliverSpeir and florian-lefebvre committed Apr 2, 2024
1 parent c3916b5 commit 4f5dc14
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-trees-wait.md
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes typing issues when using `format` and `quality` options with remote images
44 changes: 22 additions & 22 deletions packages/astro/src/assets/types.ts
Expand Up @@ -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;
} & (
| {
/**
Expand Down Expand Up @@ -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> =
Expand Down

0 comments on commit 4f5dc14

Please sign in to comment.