Skip to content

Commit

Permalink
Fix image() type to be compatible with ImageMetadata (#6568)
Browse files Browse the repository at this point in the history
* fix(assest): Fix `image()` type to be compatible with ImageMetadata

* chore: changeset
  • Loading branch information
Princesseuh authored Mar 16, 2023
1 parent b53e8b3 commit f413446
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/perfect-humans-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix image() type to be compatible with ImageMetadata
13 changes: 12 additions & 1 deletion packages/astro/src/content/template/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ declare module 'astro:content' {
export type CollectionEntry<C extends keyof typeof entryMap> =
(typeof entryMap)[C][keyof (typeof entryMap)[C]];

// This needs to be in sync with ImageMetadata
export const image: () => import('astro/zod').ZodObject<{
src: import('astro/zod').ZodString;
width: import('astro/zod').ZodNumber;
height: import('astro/zod').ZodNumber;
format: import('astro/zod').ZodString;
format: import('astro/zod').ZodUnion<
[
import('astro/zod').ZodLiteral<'png'>,
import('astro/zod').ZodLiteral<'jpg'>,
import('astro/zod').ZodLiteral<'jpeg'>,
import('astro/zod').ZodLiteral<'tiff'>,
import('astro/zod').ZodLiteral<'webp'>,
import('astro/zod').ZodLiteral<'gif'>,
import('astro/zod').ZodLiteral<'svg'>
]
>;
}>;

type BaseSchemaWithoutEffects =
Expand Down

0 comments on commit f413446

Please sign in to comment.