Content Collections Types
Astro’s content collections are a great way to manage your markdown content, and while they provide great type-safety when using their API, they don’t expose the types of the content in a way that’s easy to use in your own functions. There are a few tricks we can use to do that though.
A type that represents a union of all the collections in your project. We infer this from the
Collection Specific Slugs
A type that represents the union of slugs for a given collection. We infer this from the
CollectionEntry type. This isn’t perfect, because you need to specify the collection name, but should be pretty useful.
A type that represents the union of slugs for all collections. We infer this from the