summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/fuzzy-bats-try.md5
-rw-r--r--packages/astro/templates/content/types.d.ts4
2 files changed, 8 insertions, 1 deletions
diff --git a/.changeset/fuzzy-bats-try.md b/.changeset/fuzzy-bats-try.md
new file mode 100644
index 000000000..c4aa53caf
--- /dev/null
+++ b/.changeset/fuzzy-bats-try.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Includes "undefined" in types for getEntry
diff --git a/packages/astro/templates/content/types.d.ts b/packages/astro/templates/content/types.d.ts
index 0727ac2e5..14b57053c 100644
--- a/packages/astro/templates/content/types.d.ts
+++ b/packages/astro/templates/content/types.d.ts
@@ -92,7 +92,9 @@ declare module 'astro:content' {
collection: C,
id: E,
): E extends keyof DataEntryMap[C]
- ? Promise<DataEntryMap[C][E]>
+ ? string extends keyof DataEntryMap[C]
+ ? Promise<DataEntryMap[C][E]> | undefined
+ : Promise<DataEntryMap[C][E]>
: Promise<CollectionEntry<C> | undefined>;
/** Resolve an array of entry references from the same collection */