Skip to content

Commit 0724929

Browse files
authored
fix: include undefined in types for getEntry with content layer (#12601)
1 parent c17a364 commit 0724929

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/fuzzy-bats-try.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Includes "undefined" in types for getEntry

packages/astro/templates/content/types.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ declare module 'astro:content' {
9292
collection: C,
9393
id: E,
9494
): E extends keyof DataEntryMap[C]
95-
? Promise<DataEntryMap[C][E]>
95+
? string extends keyof DataEntryMap[C]
96+
? Promise<DataEntryMap[C][E]> | undefined
97+
: Promise<DataEntryMap[C][E]>
9698
: Promise<CollectionEntry<C> | undefined>;
9799

98100
/** Resolve an array of entry references from the same collection */

0 commit comments

Comments
 (0)