Skip to content

Commit

Permalink
fix(astro:content): deprecate getEntryBySlug and getDataEntryById
Browse files Browse the repository at this point in the history
As noted in the documentation, `getEntryBySlug` is deprecated in favor
of `getEntry`. The same applies to `getDataEntryById`.
  • Loading branch information
ArmandPhilippot committed Aug 2, 2024
1 parent 19adfaa commit 8ee2d6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-taxis-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Adds deprecation warning on `getEntryBySlug` and `getDataEntryById` functions exported by `astro:content`.
2 changes: 2 additions & 0 deletions packages/astro/templates/content/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<C> | (string & {}),
Expand All @@ -33,6 +34,7 @@ declare module 'astro:content' {
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;

/** @deprecated Use `getEntry` instead. */
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
collection: C,
entryId: E
Expand Down

0 comments on commit 8ee2d6d

Please sign in to comment.