diff --git a/.changeset/nice-jars-breathe.md b/.changeset/nice-jars-breathe.md
new file mode 100644
index 0000000000..1a47e9bc3c
--- /dev/null
+++ b/.changeset/nice-jars-breathe.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fix getImage type
diff --git a/packages/astro/client-base.d.ts b/packages/astro/client-base.d.ts
index 52bd5870fc..15c1fb9054 100644
--- a/packages/astro/client-base.d.ts
+++ b/packages/astro/client-base.d.ts
@@ -3,7 +3,26 @@
declare module 'astro:assets' {
// Exporting things one by one is a bit cumbersome, not sure if there's a better way - erika, 2023-02-03
type AstroAssets = {
- getImage: typeof import('./dist/assets/index.js').getImage;
+ // getImage's type here is different from the internal function since the Vite module implicitly pass the service config
+ /**
+ * Get an optimized image and the necessary attributes to render it.
+ *
+ * **Example**
+ * ```astro
+ * ---
+ * import { getImage } from 'astro:assets';
+ * import originalImage from '../assets/image.png';
+ *
+ * const optimizedImage = await getImage({src: originalImage, width: 1280 });
+ * ---
+ *
+ * ```
+ *
+ * This is functionally equivalent to using the `` component, as the component calls this function internally.
+ */
+ getImage: (
+ options: import('./dist/assets/types.js').ImageTransform
+ ) => Promise;
getConfiguredImageService: typeof import('./dist/assets/index.js').getConfiguredImageService;
Image: typeof import('./components/Image.astro').default;
};
diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts
index 945b5a3e86..c4b8ca751e 100644
--- a/packages/astro/src/assets/internal.ts
+++ b/packages/astro/src/assets/internal.ts
@@ -29,22 +29,6 @@ export async function getConfiguredImageService(): Promise {
return globalThis.astroAsset.imageService;
}
-/**
- * Get an optimized image and the necessary attributes to render it.
- *
- * **Example**
- * ```astro
- * ---
- * import { getImage } from 'astro:assets';
- * import originalImage from '../assets/image.png';
- *
- * const optimizedImage = await getImage({src: originalImage, width: 1280 });
- * ---
- *
- * ```
- *
- * This is functionally equivalent to using the `` component, as the component calls this function internally.
- */
export async function getImage(
options: ImageTransform,
serviceConfig: Record