-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
astro:content
types declaration to manual ambient module (#10013)
* Move `astro:content` types declaration to manual ambient module * Add changeset --------- Co-authored-by: bluwy <[email protected]>
- Loading branch information
Showing
4 changed files
with
81 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Fixes a regression in content collection types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
declare module 'astro:content' { | ||
export { z } from 'astro/zod'; | ||
|
||
// This needs to be in sync with ImageMetadata | ||
export type ImageFunction = () => import('astro/zod').ZodObject<{ | ||
src: import('astro/zod').ZodString; | ||
width: import('astro/zod').ZodNumber; | ||
height: import('astro/zod').ZodNumber; | ||
format: import('astro/zod').ZodUnion< | ||
[ | ||
import('astro/zod').ZodLiteral<'png'>, | ||
import('astro/zod').ZodLiteral<'jpg'>, | ||
import('astro/zod').ZodLiteral<'jpeg'>, | ||
import('astro/zod').ZodLiteral<'tiff'>, | ||
import('astro/zod').ZodLiteral<'webp'>, | ||
import('astro/zod').ZodLiteral<'gif'>, | ||
import('astro/zod').ZodLiteral<'svg'>, | ||
import('astro/zod').ZodLiteral<'avif'>, | ||
] | ||
>; | ||
}>; | ||
|
||
type BaseSchemaWithoutEffects = | ||
| import('astro/zod').AnyZodObject | ||
| import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]> | ||
| import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]> | ||
| import('astro/zod').ZodIntersection<BaseSchemaWithoutEffects, BaseSchemaWithoutEffects>; | ||
|
||
type BaseSchema = | ||
| BaseSchemaWithoutEffects | ||
| import('astro/zod').ZodEffects<BaseSchemaWithoutEffects>; | ||
|
||
export type SchemaContext = { image: ImageFunction }; | ||
|
||
type DataCollectionConfig<S extends BaseSchema> = { | ||
type: 'data'; | ||
schema?: S | ((context: SchemaContext) => S); | ||
}; | ||
|
||
type ContentCollectionConfig<S extends BaseSchema> = { | ||
type?: 'content'; | ||
schema?: S | ((context: SchemaContext) => S); | ||
}; | ||
|
||
type CollectionConfig<S extends BaseSchema> = | ||
| ContentCollectionConfig<S> | ||
| DataCollectionConfig<S>; | ||
|
||
export function defineCollection<S extends BaseSchema>( | ||
input: CollectionConfig<S> | ||
): CollectionConfig<S>; | ||
|
||
/** Run `astro sync` to generate high fidelity types */ | ||
export const getEntryBySlug: (...args: any[]) => any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export const getDataEntryById: (...args: any[]) => any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export const getCollection: (...args: any[]) => any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export const getEntry: (...args: any[]) => any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export const getEntries: (...args: any[]) => any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export const reference: (...args: any[]) => any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export type CollectionKey = any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export type CollectionEntry<C> = any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export type ContentCollectionKey = any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export type DataCollectionKey = any; | ||
/** Run `astro sync` to generate high fidelity types */ | ||
export type ContentConfig = any; | ||
} |