Skip to content

Commit 65bc283

Browse files
1 parent 502ad3c commit 65bc283

28 files changed

+44
-49
lines changed

.astro/content.d.ts

+25-24
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ declare module 'astro:content' {
3131
ContentEntryMap[C]
3232
>['slug'];
3333

34+
export type ReferenceDataEntry<
35+
C extends CollectionKey,
36+
E extends keyof DataEntryMap[C] = string,
37+
> = {
38+
collection: C;
39+
id: E;
40+
};
41+
export type ReferenceContentEntry<
42+
C extends keyof ContentEntryMap,
43+
E extends ValidContentEntrySlug<C> | (string & {}) = string,
44+
> = {
45+
collection: C;
46+
slug: E;
47+
};
48+
3449
/** @deprecated Use `getEntry` instead. */
3550
export function getEntryBySlug<
3651
C extends keyof ContentEntryMap,
@@ -61,19 +76,17 @@ declare module 'astro:content' {
6176
export function getEntry<
6277
C extends keyof ContentEntryMap,
6378
E extends ValidContentEntrySlug<C> | (string & {}),
64-
>(entry: {
65-
collection: C;
66-
slug: E;
67-
}): E extends ValidContentEntrySlug<C>
79+
>(
80+
entry: ReferenceContentEntry<C, E>,
81+
): E extends ValidContentEntrySlug<C>
6882
? Promise<CollectionEntry<C>>
6983
: Promise<CollectionEntry<C> | undefined>;
7084
export function getEntry<
7185
C extends keyof DataEntryMap,
7286
E extends keyof DataEntryMap[C] | (string & {}),
73-
>(entry: {
74-
collection: C;
75-
id: E;
76-
}): E extends keyof DataEntryMap[C]
87+
>(
88+
entry: ReferenceDataEntry<C, E>,
89+
): E extends keyof DataEntryMap[C]
7790
? Promise<DataEntryMap[C][E]>
7891
: Promise<CollectionEntry<C> | undefined>;
7992
export function getEntry<
@@ -99,16 +112,10 @@ declare module 'astro:content' {
99112

100113
/** Resolve an array of entry references from the same collection */
101114
export function getEntries<C extends keyof ContentEntryMap>(
102-
entries: {
103-
collection: C;
104-
slug: ValidContentEntrySlug<C>;
105-
}[],
115+
entries: ReferenceContentEntry<C, ValidContentEntrySlug<C>>[],
106116
): Promise<CollectionEntry<C>[]>;
107117
export function getEntries<C extends keyof DataEntryMap>(
108-
entries: {
109-
collection: C;
110-
id: keyof DataEntryMap[C];
111-
}[],
118+
entries: ReferenceDataEntry<C, keyof DataEntryMap[C]>[],
112119
): Promise<CollectionEntry<C>[]>;
113120

114121
export function render<C extends keyof AnyEntryMap>(
@@ -120,14 +127,8 @@ declare module 'astro:content' {
120127
): import('astro/zod').ZodEffects<
121128
import('astro/zod').ZodString,
122129
C extends keyof ContentEntryMap
123-
? {
124-
collection: C;
125-
slug: ValidContentEntrySlug<C>;
126-
}
127-
: {
128-
collection: C;
129-
id: keyof DataEntryMap[C];
130-
}
130+
? ReferenceContentEntry<C, ValidContentEntrySlug<C>>
131+
: ReferenceDataEntry<C, keyof DataEntryMap[C]>
131132
>;
132133
// Allow generic `string` to avoid excessive type errors in the config
133134
// if `dev` is not running to update as you edit.

Target/_astro/Base.astro_astro_type_script_index_0_lang.C6o5dy7m.js.map

-1
This file was deleted.

Target/_astro/Base.astro_astro_type_script_index_0_lang.C6o5dy7m.js Target/_astro/Base.astro_astro_type_script_index_0_lang.DbHbI_eE.js

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Target/_astro/Base.astro_astro_type_script_index_0_lang.DbHbI_eE.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Target/_astro/Base.astro_astro_type_script_index_1_lang.D4DYKVOQ.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)