Skip to content

Conversation

@delucis
Copy link
Member

@delucis delucis commented Dec 13, 2025

Changes

Adds an Astro.CustomImageProps interface that users can extend to support additional props in <Image>, <Picture>, and getImage(). Handling non-standard props is already supported in the Image Service API, there’s just no way to type them.

For example, with this PR, an image service that supports blurring images can add a custom blur prop:

// example.d.ts
declare namespace Astro {
  interface CustomImageProps {
    /** Apply a Gaussian blur with this radius to the image. */
    blur?: number;
  }
}

Notes:

  • This is a single interface that extends all three APIs (<Image>, <Picture>, and getImage()). Maybe hypothetically someone only wants to extend one of these? But I feel like if you’re saying any of these APIs should behave differently, you may want to export specific wrapper components/functions instead of reusing Astro’s.
  • getImage() uses a different type from the components, which doesn’t seem to share anything even though many of the properties overlap, so this required a separate change to the ImageTransform type.

Testing

Tested by patching node_modules in a project with a custom image service.

Docs

Includes a changeset and has an accompanying docs PR: withastro/docs#12897
/cc @withastro/maintainers-docs for feedback!

@changeset-bot
Copy link

changeset-bot bot commented Dec 13, 2025

🦋 Changeset detected

Latest commit: 7da3e3d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) docs pr labels Dec 13, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 13, 2025

CodSpeed Performance Report

Merging #15014 will not alter performance

Comparing chris/image-props (7da3e3d) with main (8cdaa00)1

Summary

✅ 6 untouched

Footnotes

  1. No successful run was found on main (0d2adac) during the generation of this report, so 8cdaa00 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@delucis delucis merged commit a178422 into main Dec 15, 2025
27 checks passed
@delucis delucis deleted the chris/image-props branch December 15, 2025 21:01
@astrobot-houston astrobot-houston mentioned this pull request Dec 15, 2025
@codenomnom
Copy link
Contributor

@delucis oh my, thank you! ❤️

dadezzz pushed a commit to dadezzz/ice-notes that referenced this pull request Dec 19, 2025
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`5.16.5` -> `5.16.6`](https://renovatebot.com/diffs/npm/astro/5.16.5/5.16.6) | ![age](https://developer.mend.io/api/mc/badges/age/npm/astro/5.16.6?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/astro/5.16.5/5.16.6?slim=true) |

---

### Release Notes

<details>
<summary>withastro/astro (astro)</summary>

### [`v5.16.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5166)

[Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.16.6)

##### Patch Changes

- [#&#8203;14982](withastro/astro#14982) [`6849e38`](withastro/astro@6849e38) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes images outside the project directory not working when using astro:assets in development mode

- [#&#8203;14987](withastro/astro#14987) [`9dd9fca`](withastro/astro@9dd9fca) Thanks [@&#8203;Princesseuh](https://github.com/Princesseuh)! - Fixes SVGs not working in dev mode when using the passthrough image service

- [#&#8203;15014](withastro/astro#15014) [`a178422`](withastro/astro@a178422) Thanks [@&#8203;delucis](https://github.com/delucis)! - Adds support for extending the type of the props accepted by Astro’s `<Image>` component, `<Picture>` component, and `getImage()` API.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41Mi44IiwidXBkYXRlZEluVmVyIjoiNDIuNTIuOCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants