From 3546e72c03983c9d81d5cd31c0edf9ddcd68a853 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Tue, 3 Dec 2024 15:23:25 +0000 Subject: [PATCH] fix: include undefined in types for getEntry with content layer --- .changeset/fuzzy-bats-try.md | 5 +++++ packages/astro/templates/content/types.d.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/fuzzy-bats-try.md diff --git a/.changeset/fuzzy-bats-try.md b/.changeset/fuzzy-bats-try.md new file mode 100644 index 000000000000..c4aa53caf951 --- /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 0727ac2e5578..14b57053c37d 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 + ? string extends keyof DataEntryMap[C] + ? Promise | undefined + : Promise : Promise | undefined>; /** Resolve an array of entry references from the same collection */