From 09ec2cadce01a9a1f9c54ac433f137348907aa56 Mon Sep 17 00:00:00 2001 From: Armand Philippot <59021693+ArmandPhilippot@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:31:32 +0200 Subject: [PATCH] fix(astro:content): add deprecated to `getEntryBySlug` & `getDataEntryById` (#11600) Co-authored-by: Chris Swithinbank --- .changeset/dull-taxis-warn.md | 5 +++++ packages/astro/templates/content/types.d.ts | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/dull-taxis-warn.md diff --git a/.changeset/dull-taxis-warn.md b/.changeset/dull-taxis-warn.md new file mode 100644 index 000000000000..49129685ac8d --- /dev/null +++ b/.changeset/dull-taxis-warn.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Deprecates `getEntryBySlug` and `getDataEntryById` functions exported by `astro:content` in favor of `getEntry`. diff --git a/packages/astro/templates/content/types.d.ts b/packages/astro/templates/content/types.d.ts index 9ac20a7f1457..23c5eb984547 100644 --- a/packages/astro/templates/content/types.d.ts +++ b/packages/astro/templates/content/types.d.ts @@ -22,6 +22,7 @@ declare module 'astro:content' { ContentEntryMap[C] >['slug']; + /** @deprecated Use `getEntry` instead. */ export function getEntryBySlug< C extends keyof ContentEntryMap, E extends ValidContentEntrySlug | (string & {}), @@ -33,6 +34,7 @@ declare module 'astro:content' { ? Promise> : Promise | undefined>; + /** @deprecated Use `getEntry` instead. */ export function getDataEntryById( collection: C, entryId: E