|
| 1 | +declare module 'astro:content' { |
| 2 | + interface Render { |
| 3 | + '.mdx': Promise<{ |
| 4 | + Content: import('astro').MarkdownInstance<{}>['Content']; |
| 5 | + headings: import('astro').MarkdownHeading[]; |
| 6 | + remarkPluginFrontmatter: Record<string, any>; |
| 7 | + }>; |
| 8 | + } |
| 9 | +} |
| 10 | + |
| 11 | +declare module 'astro:content' { |
| 12 | + interface Render { |
| 13 | + '.md': Promise<{ |
| 14 | + Content: import('astro').MarkdownInstance<{}>['Content']; |
| 15 | + headings: import('astro').MarkdownHeading[]; |
| 16 | + remarkPluginFrontmatter: Record<string, any>; |
| 17 | + }>; |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +declare module 'astro:content' { |
| 22 | + type Flatten<T> = T extends { [K: string]: infer U } ? U : never; |
| 23 | + |
| 24 | + export type CollectionKey = keyof AnyEntryMap; |
| 25 | + export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>; |
| 26 | + |
| 27 | + export type ContentCollectionKey = keyof ContentEntryMap; |
| 28 | + export type DataCollectionKey = keyof DataEntryMap; |
| 29 | + |
| 30 | + type AllValuesOf<T> = T extends any ? T[keyof T] : never; |
| 31 | + type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf< |
| 32 | + ContentEntryMap[C] |
| 33 | + >['slug']; |
| 34 | + |
| 35 | + export function getEntryBySlug< |
| 36 | + C extends keyof ContentEntryMap, |
| 37 | + E extends ValidContentEntrySlug<C> | (string & {}), |
| 38 | + >( |
| 39 | + collection: C, |
| 40 | + // Note that this has to accept a regular string too, for SSR |
| 41 | + entrySlug: E |
| 42 | + ): E extends ValidContentEntrySlug<C> |
| 43 | + ? Promise<CollectionEntry<C>> |
| 44 | + : Promise<CollectionEntry<C> | undefined>; |
| 45 | + |
| 46 | + export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>( |
| 47 | + collection: C, |
| 48 | + entryId: E |
| 49 | + ): Promise<CollectionEntry<C>>; |
| 50 | + |
| 51 | + export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>( |
| 52 | + collection: C, |
| 53 | + filter?: (entry: CollectionEntry<C>) => entry is E |
| 54 | + ): Promise<E[]>; |
| 55 | + export function getCollection<C extends keyof AnyEntryMap>( |
| 56 | + collection: C, |
| 57 | + filter?: (entry: CollectionEntry<C>) => unknown |
| 58 | + ): Promise<CollectionEntry<C>[]>; |
| 59 | + |
| 60 | + export function getEntry< |
| 61 | + C extends keyof ContentEntryMap, |
| 62 | + E extends ValidContentEntrySlug<C> | (string & {}), |
| 63 | + >(entry: { |
| 64 | + collection: C; |
| 65 | + slug: E; |
| 66 | + }): E extends ValidContentEntrySlug<C> |
| 67 | + ? Promise<CollectionEntry<C>> |
| 68 | + : Promise<CollectionEntry<C> | undefined>; |
| 69 | + export function getEntry< |
| 70 | + C extends keyof DataEntryMap, |
| 71 | + E extends keyof DataEntryMap[C] | (string & {}), |
| 72 | + >(entry: { |
| 73 | + collection: C; |
| 74 | + id: E; |
| 75 | + }): E extends keyof DataEntryMap[C] |
| 76 | + ? Promise<DataEntryMap[C][E]> |
| 77 | + : Promise<CollectionEntry<C> | undefined>; |
| 78 | + export function getEntry< |
| 79 | + C extends keyof ContentEntryMap, |
| 80 | + E extends ValidContentEntrySlug<C> | (string & {}), |
| 81 | + >( |
| 82 | + collection: C, |
| 83 | + slug: E |
| 84 | + ): E extends ValidContentEntrySlug<C> |
| 85 | + ? Promise<CollectionEntry<C>> |
| 86 | + : Promise<CollectionEntry<C> | undefined>; |
| 87 | + export function getEntry< |
| 88 | + C extends keyof DataEntryMap, |
| 89 | + E extends keyof DataEntryMap[C] | (string & {}), |
| 90 | + >( |
| 91 | + collection: C, |
| 92 | + id: E |
| 93 | + ): E extends keyof DataEntryMap[C] |
| 94 | + ? Promise<DataEntryMap[C][E]> |
| 95 | + : Promise<CollectionEntry<C> | undefined>; |
| 96 | + |
| 97 | + /** Resolve an array of entry references from the same collection */ |
| 98 | + export function getEntries<C extends keyof ContentEntryMap>( |
| 99 | + entries: { |
| 100 | + collection: C; |
| 101 | + slug: ValidContentEntrySlug<C>; |
| 102 | + }[] |
| 103 | + ): Promise<CollectionEntry<C>[]>; |
| 104 | + export function getEntries<C extends keyof DataEntryMap>( |
| 105 | + entries: { |
| 106 | + collection: C; |
| 107 | + id: keyof DataEntryMap[C]; |
| 108 | + }[] |
| 109 | + ): Promise<CollectionEntry<C>[]>; |
| 110 | + |
| 111 | + export function reference<C extends keyof AnyEntryMap>( |
| 112 | + collection: C |
| 113 | + ): import('astro/zod').ZodEffects< |
| 114 | + import('astro/zod').ZodString, |
| 115 | + C extends keyof ContentEntryMap |
| 116 | + ? { |
| 117 | + collection: C; |
| 118 | + slug: ValidContentEntrySlug<C>; |
| 119 | + } |
| 120 | + : { |
| 121 | + collection: C; |
| 122 | + id: keyof DataEntryMap[C]; |
| 123 | + } |
| 124 | + >; |
| 125 | + // Allow generic `string` to avoid excessive type errors in the config |
| 126 | + // if `dev` is not running to update as you edit. |
| 127 | + // Invalid collection names will be caught at build time. |
| 128 | + export function reference<C extends string>( |
| 129 | + collection: C |
| 130 | + ): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>; |
| 131 | + |
| 132 | + type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T; |
| 133 | + type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer< |
| 134 | + ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']> |
| 135 | + >; |
| 136 | + |
| 137 | + type ContentEntryMap = { |
| 138 | + "docs": { |
| 139 | +"browsers/ifs-browser.mdx": { |
| 140 | + id: "browsers/ifs-browser.mdx"; |
| 141 | + slug: "browsers/ifs-browser"; |
| 142 | + body: string; |
| 143 | + collection: "docs"; |
| 144 | + data: InferEntrySchema<"docs"> |
| 145 | +} & { render(): Render[".mdx"] }; |
| 146 | +"browsers/index.mdx": { |
| 147 | + id: "browsers/index.mdx"; |
| 148 | + slug: "browsers"; |
| 149 | + body: string; |
| 150 | + collection: "docs"; |
| 151 | + data: InferEntrySchema<"docs"> |
| 152 | +} & { render(): Render[".mdx"] }; |
| 153 | +"browsers/object-browser.mdx": { |
| 154 | + id: "browsers/object-browser.mdx"; |
| 155 | + slug: "browsers/object-browser"; |
| 156 | + body: string; |
| 157 | + collection: "docs"; |
| 158 | + data: InferEntrySchema<"docs"> |
| 159 | +} & { render(): Render[".mdx"] }; |
| 160 | +"browsers/user-library-list.mdx": { |
| 161 | + id: "browsers/user-library-list.mdx"; |
| 162 | + slug: "browsers/user-library-list"; |
| 163 | + body: string; |
| 164 | + collection: "docs"; |
| 165 | + data: InferEntrySchema<"docs"> |
| 166 | +} & { render(): Render[".mdx"] }; |
| 167 | +"dev/api.mdx": { |
| 168 | + id: "dev/api.mdx"; |
| 169 | + slug: "dev/api"; |
| 170 | + body: string; |
| 171 | + collection: "docs"; |
| 172 | + data: InferEntrySchema<"docs"> |
| 173 | +} & { render(): Render[".mdx"] }; |
| 174 | +"dev/getting_started.mdx": { |
| 175 | + id: "dev/getting_started.mdx"; |
| 176 | + slug: "dev/getting_started"; |
| 177 | + body: string; |
| 178 | + collection: "docs"; |
| 179 | + data: InferEntrySchema<"docs"> |
| 180 | +} & { render(): Render[".mdx"] }; |
| 181 | +"dev/scope.mdx": { |
| 182 | + id: "dev/scope.mdx"; |
| 183 | + slug: "dev/scope"; |
| 184 | + body: string; |
| 185 | + collection: "docs"; |
| 186 | + data: InferEntrySchema<"docs"> |
| 187 | +} & { render(): Render[".mdx"] }; |
| 188 | +"dev/variables.mdx": { |
| 189 | + id: "dev/variables.mdx"; |
| 190 | + slug: "dev/variables"; |
| 191 | + body: string; |
| 192 | + collection: "docs"; |
| 193 | + data: InferEntrySchema<"docs"> |
| 194 | +} & { render(): Render[".mdx"] }; |
| 195 | +"developing/actions/custom-vars.mdx": { |
| 196 | + id: "developing/actions/custom-vars.mdx"; |
| 197 | + slug: "developing/actions/custom-vars"; |
| 198 | + body: string; |
| 199 | + collection: "docs"; |
| 200 | + data: InferEntrySchema<"docs"> |
| 201 | +} & { render(): Render[".mdx"] }; |
| 202 | +"developing/actions/execution.mdx": { |
| 203 | + id: "developing/actions/execution.mdx"; |
| 204 | + slug: "developing/actions/execution"; |
| 205 | + body: string; |
| 206 | + collection: "docs"; |
| 207 | + data: InferEntrySchema<"docs"> |
| 208 | +} & { render(): Render[".mdx"] }; |
| 209 | +"developing/actions/index.mdx": { |
| 210 | + id: "developing/actions/index.mdx"; |
| 211 | + slug: "developing/actions"; |
| 212 | + body: string; |
| 213 | + collection: "docs"; |
| 214 | + data: InferEntrySchema<"docs"> |
| 215 | +} & { render(): Render[".mdx"] }; |
| 216 | +"developing/debug/index.mdx": { |
| 217 | + id: "developing/debug/index.mdx"; |
| 218 | + slug: "developing/debug"; |
| 219 | + body: string; |
| 220 | + collection: "docs"; |
| 221 | + data: InferEntrySchema<"docs"> |
| 222 | +} & { render(): Render[".mdx"] }; |
| 223 | +"developing/editing-compiling.mdx": { |
| 224 | + id: "developing/editing-compiling.mdx"; |
| 225 | + slug: "developing/editing-compiling"; |
| 226 | + body: string; |
| 227 | + collection: "docs"; |
| 228 | + data: InferEntrySchema<"docs"> |
| 229 | +} & { render(): Render[".mdx"] }; |
| 230 | +"developing/iledocs.mdx": { |
| 231 | + id: "developing/iledocs.mdx"; |
| 232 | + slug: "developing/iledocs"; |
| 233 | + body: string; |
| 234 | + collection: "docs"; |
| 235 | + data: InferEntrySchema<"docs"> |
| 236 | +} & { render(): Render[".mdx"] }; |
| 237 | +"developing/local/actions.mdx": { |
| 238 | + id: "developing/local/actions.mdx"; |
| 239 | + slug: "developing/local/actions"; |
| 240 | + body: string; |
| 241 | + collection: "docs"; |
| 242 | + data: InferEntrySchema<"docs"> |
| 243 | +} & { render(): Render[".mdx"] }; |
| 244 | +"developing/local/azure.mdx": { |
| 245 | + id: "developing/local/azure.mdx"; |
| 246 | + slug: "developing/local/azure"; |
| 247 | + body: string; |
| 248 | + collection: "docs"; |
| 249 | + data: InferEntrySchema<"docs"> |
| 250 | +} & { render(): Render[".mdx"] }; |
| 251 | +"developing/local/getting-started.mdx": { |
| 252 | + id: "developing/local/getting-started.mdx"; |
| 253 | + slug: "developing/local/getting-started"; |
| 254 | + body: string; |
| 255 | + collection: "docs"; |
| 256 | + data: InferEntrySchema<"docs"> |
| 257 | +} & { render(): Render[".mdx"] }; |
| 258 | +"developing/local/git.mdx": { |
| 259 | + id: "developing/local/git.mdx"; |
| 260 | + slug: "developing/local/git"; |
| 261 | + body: string; |
| 262 | + collection: "docs"; |
| 263 | + data: InferEntrySchema<"docs"> |
| 264 | +} & { render(): Render[".mdx"] }; |
| 265 | +"developing/local/migrate.mdx": { |
| 266 | + id: "developing/local/migrate.mdx"; |
| 267 | + slug: "developing/local/migrate"; |
| 268 | + body: string; |
| 269 | + collection: "docs"; |
| 270 | + data: InferEntrySchema<"docs"> |
| 271 | +} & { render(): Render[".mdx"] }; |
| 272 | +"developing/local/structure.mdx": { |
| 273 | + id: "developing/local/structure.mdx"; |
| 274 | + slug: "developing/local/structure"; |
| 275 | + body: string; |
| 276 | + collection: "docs"; |
| 277 | + data: InferEntrySchema<"docs"> |
| 278 | +} & { render(): Render[".mdx"] }; |
| 279 | +"developing/sourcedates.mdx": { |
| 280 | + id: "developing/sourcedates.mdx"; |
| 281 | + slug: "developing/sourcedates"; |
| 282 | + body: string; |
| 283 | + collection: "docs"; |
| 284 | + data: InferEntrySchema<"docs"> |
| 285 | +} & { render(): Render[".mdx"] }; |
| 286 | +"extensions/db2i/index.mdx": { |
| 287 | + id: "extensions/db2i/index.mdx"; |
| 288 | + slug: "extensions/db2i"; |
| 289 | + body: string; |
| 290 | + collection: "docs"; |
| 291 | + data: InferEntrySchema<"docs"> |
| 292 | +} & { render(): Render[".mdx"] }; |
| 293 | +"extensions/rpgle/faq.mdx": { |
| 294 | + id: "extensions/rpgle/faq.mdx"; |
| 295 | + slug: "extensions/rpgle/faq"; |
| 296 | + body: string; |
| 297 | + collection: "docs"; |
| 298 | + data: InferEntrySchema<"docs"> |
| 299 | +} & { render(): Render[".mdx"] }; |
| 300 | +"extensions/rpgle/index.mdx": { |
| 301 | + id: "extensions/rpgle/index.mdx"; |
| 302 | + slug: "extensions/rpgle"; |
| 303 | + body: string; |
| 304 | + collection: "docs"; |
| 305 | + data: InferEntrySchema<"docs"> |
| 306 | +} & { render(): Render[".mdx"] }; |
| 307 | +"extensions/rpgle/linter.mdx": { |
| 308 | + id: "extensions/rpgle/linter.mdx"; |
| 309 | + slug: "extensions/rpgle/linter"; |
| 310 | + body: string; |
| 311 | + collection: "docs"; |
| 312 | + data: InferEntrySchema<"docs"> |
| 313 | +} & { render(): Render[".mdx"] }; |
| 314 | +"index.mdx": { |
| 315 | + id: "index.mdx"; |
| 316 | + slug: "index"; |
| 317 | + body: string; |
| 318 | + collection: "docs"; |
| 319 | + data: InferEntrySchema<"docs"> |
| 320 | +} & { render(): Render[".mdx"] }; |
| 321 | +"login.mdx": { |
| 322 | + id: "login.mdx"; |
| 323 | + slug: "login"; |
| 324 | + body: string; |
| 325 | + collection: "docs"; |
| 326 | + data: InferEntrySchema<"docs"> |
| 327 | +} & { render(): Render[".mdx"] }; |
| 328 | +"settings/connection.mdx": { |
| 329 | + id: "settings/connection.mdx"; |
| 330 | + slug: "settings/connection"; |
| 331 | + body: string; |
| 332 | + collection: "docs"; |
| 333 | + data: InferEntrySchema<"docs"> |
| 334 | +} & { render(): Render[".mdx"] }; |
| 335 | +"settings/global.mdx": { |
| 336 | + id: "settings/global.mdx"; |
| 337 | + slug: "settings/global"; |
| 338 | + body: string; |
| 339 | + collection: "docs"; |
| 340 | + data: InferEntrySchema<"docs"> |
| 341 | +} & { render(): Render[".mdx"] }; |
| 342 | +"settings/profiles.mdx": { |
| 343 | + id: "settings/profiles.mdx"; |
| 344 | + slug: "settings/profiles"; |
| 345 | + body: string; |
| 346 | + collection: "docs"; |
| 347 | + data: InferEntrySchema<"docs"> |
| 348 | +} & { render(): Render[".mdx"] }; |
| 349 | +"tips/ccsid.mdx": { |
| 350 | + id: "tips/ccsid.mdx"; |
| 351 | + slug: "tips/ccsid"; |
| 352 | + body: string; |
| 353 | + collection: "docs"; |
| 354 | + data: InferEntrySchema<"docs"> |
| 355 | +} & { render(): Render[".mdx"] }; |
| 356 | +"tips/quickstart.mdx": { |
| 357 | + id: "tips/quickstart.mdx"; |
| 358 | + slug: "tips/quickstart"; |
| 359 | + body: string; |
| 360 | + collection: "docs"; |
| 361 | + data: InferEntrySchema<"docs"> |
| 362 | +} & { render(): Render[".mdx"] }; |
| 363 | +"tips/setup.mdx": { |
| 364 | + id: "tips/setup.mdx"; |
| 365 | + slug: "tips/setup"; |
| 366 | + body: string; |
| 367 | + collection: "docs"; |
| 368 | + data: InferEntrySchema<"docs"> |
| 369 | +} & { render(): Render[".mdx"] }; |
| 370 | +"tips/terminals.mdx": { |
| 371 | + id: "tips/terminals.mdx"; |
| 372 | + slug: "tips/terminals"; |
| 373 | + body: string; |
| 374 | + collection: "docs"; |
| 375 | + data: InferEntrySchema<"docs"> |
| 376 | +} & { render(): Render[".mdx"] }; |
| 377 | +"tips/tricks.mdx": { |
| 378 | + id: "tips/tricks.mdx"; |
| 379 | + slug: "tips/tricks"; |
| 380 | + body: string; |
| 381 | + collection: "docs"; |
| 382 | + data: InferEntrySchema<"docs"> |
| 383 | +} & { render(): Render[".mdx"] }; |
| 384 | +}; |
| 385 | + |
| 386 | + }; |
| 387 | + |
| 388 | + type DataEntryMap = { |
| 389 | + |
| 390 | + }; |
| 391 | + |
| 392 | + type AnyEntryMap = ContentEntryMap & DataEntryMap; |
| 393 | + |
| 394 | + export type ContentConfig = typeof import("../src/content/config.js"); |
| 395 | +} |
0 commit comments