diff --git a/.changeset/small-apes-clap.md b/.changeset/small-apes-clap.md new file mode 100644 index 0000000000..1a682604af --- /dev/null +++ b/.changeset/small-apes-clap.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Add `CollectionKey`, `ContentCollectionKey`, and `DataCollectionKey` exports to `astro:content` diff --git a/packages/astro/content-types.template.d.ts b/packages/astro/content-types.template.d.ts index 596764fe65..8e5b59c39a 100644 --- a/packages/astro/content-types.template.d.ts +++ b/packages/astro/content-types.template.d.ts @@ -10,9 +10,14 @@ declare module 'astro:content' { declare module 'astro:content' { export { z } from 'astro/zod'; + + type Flatten = T extends { [K: string]: infer U } ? U : never; + + export type CollectionKey = keyof AnyEntryMap; + export type CollectionEntry = Flatten; - type Flatten = T extends { [K: string]: infer U } ? U : never; - export type CollectionEntry = Flatten; + export type ContentCollectionKey = keyof ContentEntryMap; + export type DataCollectionKey = keyof DataEntryMap; // This needs to be in sync with ImageMetadata export type ImageFunction = () => import('astro/zod').ZodObject<{