#How to reuse Content Collection Schema with images

3 messages · Page 1 of 1 (latest)

icy light
#

Anyone? Anyone? Bueller?

pallid viper
#

If it's a collection, may be you could try with "type CollectionEntry" ?

icy light
#

It's actually a sub-part I reuse in a few collections... I tried this:

let ceBlogs: CollectionEntry<"blogs">
export type Props = {
    title: string
    description: string
    seo?: z.infer<typeof ceBlogs.data.seo>
}

but because ceBlogs.data.seo is optional, TS complains: Type 'undefined' is not assignable to type 'ZodType<any, any, any>'.
If I remove .optional(), then it complains that: ...is missing the following properties from type 'ZodType<any, any, any>': _type, _output, _input, _def, and 31 more. so it doesn't see it as a ZodType.