Skip to content

Commit

Permalink
remove ImageMetadata typing; refine now types the arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Jutan committed Mar 13, 2023
1 parent 1943cde commit b34ce85
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/content/docs/en/guides/assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,10 @@ A new `image` helper for content collections lets you validate the image metadat

```ts title="src/content/config.ts"
import { defineCollection, z, image } from "astro:content";
import type { ImageMetadata } from "astro/dist/assets/types";

const blogCollection = defineCollection({
schema: z.object({
title: z.string(),
cover: image().refine((img: ImageMetadata) => img.width >= 1080, {
cover: image().refine((img) => img.width >= 1080, {
message: "Cover image must be at least 1080 pixels wide!",
}),
coverAlt: z.string(),
Expand Down

0 comments on commit b34ce85

Please sign in to comment.