Skip to content

Commit

Permalink
fix(astro:content): add deprecated to getEntryBySlug & `getDataEntr…
Browse files Browse the repository at this point in the history
…yById` (#11600)

Co-authored-by: Chris Swithinbank <[email protected]>
  • Loading branch information
ArmandPhilippot and delucis authored Aug 2, 2024
1 parent 1b3c81c commit 09ec2ca
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
---

Deprecates `getEntryBySlug` and `getDataEntryById` functions exported by `astro:content` in favor of `getEntry`.
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 09ec2ca

Please sign in to comment.