1- declare module " astro:content" {
1+ declare module ' astro:content' {
22 export interface RenderResult {
3- Content : import ( " astro/runtime/server/index.js" ) . AstroComponentFactory ;
4- headings : import ( " astro" ) . MarkdownHeading [ ] ;
3+ Content : import ( ' astro/runtime/server/index.js' ) . AstroComponentFactory ;
4+ headings : import ( ' astro' ) . MarkdownHeading [ ] ;
55 remarkPluginFrontmatter: Record < string , any > ;
66 }
77 interface Render {
8- " .md" : Promise < RenderResult > ;
8+ ' .md' : Promise < RenderResult > ;
99 }
1010
1111 export interface RenderedContent {
@@ -19,9 +19,7 @@ declare module "astro:content" {
1919 type Flatten < T > = T extends { [ K : string ] : infer U } ? U : never ;
2020
2121 export type CollectionKey = keyof DataEntryMap ;
22- export type CollectionEntry < C extends CollectionKey > = Flatten <
23- DataEntryMap [ C ]
24- > ;
22+ export type CollectionEntry < C extends CollectionKey > = Flatten < DataEntryMap [ C ] > ;
2523
2624 type AllValuesOf < T > = T extends any ? T [ keyof T ] : never ;
2725
@@ -33,17 +31,12 @@ declare module "astro:content" {
3331 id : E ;
3432 } ;
3533
36- export type ReferenceLiveEntry <
37- C extends keyof LiveContentConfig [ "collections" ] ,
38- > = {
34+ export type ReferenceLiveEntry < C extends keyof LiveContentConfig [ 'collections' ] > = {
3935 collection : C ;
4036 id : string ;
4137 } ;
4238
43- export function getCollection <
44- C extends keyof DataEntryMap ,
45- E extends CollectionEntry < C > ,
46- > (
39+ export function getCollection < C extends keyof DataEntryMap , E extends CollectionEntry < C > > (
4740 collection : C ,
4841 filter ?: ( entry : CollectionEntry < C > ) => entry is E ,
4942 ) : Promise < E [ ] > ;
@@ -52,16 +45,11 @@ declare module "astro:content" {
5245 filter ?: ( entry : CollectionEntry < C > ) => unknown ,
5346 ) : Promise < CollectionEntry < C > [ ] > ;
5447
55- export function getLiveCollection <
56- C extends keyof LiveContentConfig [ "collections" ] ,
57- > (
48+ export function getLiveCollection < C extends keyof LiveContentConfig [ 'collections' ] > (
5849 collection : C ,
5950 filter ?: LiveLoaderCollectionFilterType < C > ,
6051 ) : Promise <
61- import ( "astro" ) . LiveDataCollectionResult <
62- LiveLoaderDataType < C > ,
63- LiveLoaderErrorType < C >
64- >
52+ import ( 'astro' ) . LiveDataCollectionResult < LiveLoaderDataType < C > , LiveLoaderErrorType < C > >
6553 > ;
6654
6755 export function getEntry <
@@ -83,17 +71,10 @@ declare module "astro:content" {
8371 ? Promise < DataEntryMap [ C ] [ E ] > | undefined
8472 : Promise < DataEntryMap [ C ] [ E ] >
8573 : Promise < CollectionEntry < C > | undefined > ;
86- export function getLiveEntry <
87- C extends keyof LiveContentConfig [ "collections" ] ,
88- > (
74+ export function getLiveEntry < C extends keyof LiveContentConfig [ 'collections' ] > (
8975 collection : C ,
9076 filter : string | LiveLoaderEntryFilterType < C > ,
91- ) : Promise <
92- import ( "astro" ) . LiveDataEntryResult <
93- LiveLoaderDataType < C > ,
94- LiveLoaderErrorType < C >
95- >
96- > ;
77+ ) : Promise < import ( 'astro' ) . LiveDataEntryResult < LiveLoaderDataType < C > , LiveLoaderErrorType < C > > > ;
9778
9879 /** Resolve an array of entry references from the same collection */
9980 export function getEntries < C extends keyof DataEntryMap > (
@@ -113,9 +94,9 @@ declare module "astro:content" {
11394 | ( string & { } ) ,
11495 > (
11596 collection : C ,
116- ) : import ( " astro/zod" ) . ZodPipe <
117- import ( " astro/zod" ) . ZodString ,
118- import ( " astro/zod" ) . ZodTransform <
97+ ) : import ( ' astro/zod' ) . ZodPipe <
98+ import ( ' astro/zod' ) . ZodString ,
99+ import ( ' astro/zod' ) . ZodTransform <
119100 C extends keyof DataEntryMap
120101 ? {
121102 collection : C ;
@@ -126,67 +107,47 @@ declare module "astro:content" {
126107 >
127108 > ;
128109
129- type ReturnTypeOrOriginal < T > = T extends ( ...args : any [ ] ) = > infer R
130- ? R
131- : T ;
132- type InferEntrySchema < C extends keyof DataEntryMap > =
133- import ( "astro/zod" ) . infer <
134- ReturnTypeOrOriginal <
135- Required < ContentConfig [ "collections" ] [ C ] > [ "schema" ]
136- >
137- > ;
110+ type ReturnTypeOrOriginal < T > = T extends ( ...args : any [ ] ) = > infer R ? R : T ;
111+ type InferEntrySchema < C extends keyof DataEntryMap > = import ( 'astro/zod' ) . infer <
112+ ReturnTypeOrOriginal < Required < ContentConfig [ 'collections' ] [ C ] > [ 'schema' ] >
113+ > ;
138114 type ExtractLoaderConfig < T > = T extends { loader : infer L } ? L : never ;
139115 type InferLoaderSchema <
140116 C extends keyof DataEntryMap ,
141- L = ExtractLoaderConfig < ContentConfig [ " collections" ] [ C ] > ,
142- > = L extends { schema : import ( " astro/zod" ) . ZodSchema }
143- ? import ( " astro/zod" ) . infer < L [ " schema" ] >
117+ L = ExtractLoaderConfig < ContentConfig [ ' collections' ] [ C ] > ,
118+ > = L extends { schema : import ( ' astro/zod' ) . ZodSchema }
119+ ? import ( ' astro/zod' ) . infer < L [ ' schema' ] >
144120 : any ;
145121
146- type DataEntryMap = { } ;
122+ type DataEntryMap = {
123+
124+ } ;
147125
148- type ExtractLoaderTypes < T > = T extends import ( " astro/loaders" ) . LiveLoader <
126+ type ExtractLoaderTypes < T > = T extends import ( ' astro/loaders' ) . LiveLoader <
149127 infer TData ,
150128 infer TEntryFilter ,
151129 infer TCollectionFilter ,
152130 infer TError
153131 >
154- ? {
155- data : TData ;
156- entryFilter : TEntryFilter ;
157- collectionFilter : TCollectionFilter ;
158- error : TError ;
159- }
160- : {
161- data : never ;
162- entryFilter : never ;
163- collectionFilter : never ;
164- error : never ;
165- } ;
166- type ExtractEntryFilterType < T > = ExtractLoaderTypes < T > [ "entryFilter" ] ;
167- type ExtractCollectionFilterType < T > =
168- ExtractLoaderTypes < T > [ "collectionFilter" ] ;
169- type ExtractErrorType < T > = ExtractLoaderTypes < T > [ "error" ] ;
170-
171- type LiveLoaderDataType < C extends keyof LiveContentConfig [ "collections" ] > =
172- LiveContentConfig [ "collections" ] [ C ] [ "schema" ] extends undefined
173- ? ExtractDataType < LiveContentConfig [ "collections" ] [ C ] [ "loader" ] >
174- : import ( "astro/zod" ) . infer <
175- Exclude <
176- LiveContentConfig [ "collections" ] [ C ] [ "schema" ] ,
177- undefined
178- >
132+ ? { data : TData ; entryFilter : TEntryFilter ; collectionFilter : TCollectionFilter ; error : TError }
133+ : { data : never ; entryFilter : never ; collectionFilter : never ; error : never } ;
134+ type ExtractEntryFilterType < T > = ExtractLoaderTypes < T > [ 'entryFilter' ] ;
135+ type ExtractCollectionFilterType < T > = ExtractLoaderTypes < T > [ 'collectionFilter' ] ;
136+ type ExtractErrorType < T > = ExtractLoaderTypes < T > [ 'error' ] ;
137+
138+ type LiveLoaderDataType < C extends keyof LiveContentConfig [ 'collections' ] > =
139+ LiveContentConfig [ 'collections' ] [ C ] [ 'schema' ] extends undefined
140+ ? ExtractDataType < LiveContentConfig [ 'collections' ] [ C ] [ 'loader' ] >
141+ : import ( 'astro/zod' ) . infer <
142+ Exclude < LiveContentConfig [ 'collections' ] [ C ] [ 'schema' ] , undefined >
179143 > ;
180- type LiveLoaderEntryFilterType <
181- C extends keyof LiveContentConfig [ "collections" ] ,
182- > = ExtractEntryFilterType < LiveContentConfig [ "collections" ] [ C ] [ "loader" ] > ;
183- type LiveLoaderCollectionFilterType <
184- C extends keyof LiveContentConfig [ "collections" ] ,
185- > = ExtractCollectionFilterType <
186- LiveContentConfig [ "collections" ] [ C ] [ "loader" ]
144+ type LiveLoaderEntryFilterType < C extends keyof LiveContentConfig [ 'collections' ] > =
145+ ExtractEntryFilterType < LiveContentConfig [ 'collections' ] [ C ] [ 'loader' ] > ;
146+ type LiveLoaderCollectionFilterType < C extends keyof LiveContentConfig [ 'collections' ] > =
147+ ExtractCollectionFilterType < LiveContentConfig [ 'collections' ] [ C ] [ 'loader' ] > ;
148+ type LiveLoaderErrorType < C extends keyof LiveContentConfig [ 'collections' ] > = ExtractErrorType <
149+ LiveContentConfig [ 'collections' ] [ C ] [ 'loader' ]
187150 > ;
188- type LiveLoaderErrorType < C extends keyof LiveContentConfig [ "collections" ] > =
189- ExtractErrorType < LiveContentConfig [ "collections" ] [ C ] [ "loader" ] > ;
190151
191152 export type ContentConfig = never ;
192153 export type LiveContentConfig = never ;
0 commit comments