0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00

fix: foreignKeys references signature

This commit is contained in:
bholmesdev 2024-02-01 16:46:01 -05:00
parent 4aaf393318
commit 02e582514b

View file

@ -197,12 +197,12 @@ export type FieldsConfig = z.input<typeof collectionSchema>['fields'];
interface CollectionConfig<TFields extends FieldsConfig>
// use `extends` to ensure types line up with zod,
// only adding generics for type completions.
extends Pick<z.input<typeof collectionSchema>, 'fields' | 'indexes'> {
extends Pick<z.input<typeof collectionSchema>, 'fields' | 'indexes' | 'foreignKeys'> {
fields: TFields;
foreignKeys?: Array<{
fields: MaybeArray<Extract<keyof TFields, string>>;
// TODO: runtime error if parent collection doesn't match for all fields. Can't put a generic here...
references: MaybeArray<ReferenceableField>;
references: () => MaybeArray<ReferenceableField>;
}>;
indexes?: Record<string, IndexConfig<TFields>>;
}