Skip to content

feat: added types to allow the creation of user space content services#7607

Merged
Princesseuh merged 5 commits intowithastro:mainfrom
FineWolf:feature/collection-name-type
Sep 13, 2023
Merged

feat: added types to allow the creation of user space content services#7607
Princesseuh merged 5 commits intowithastro:mainfrom
FineWolf:feature/collection-name-type

Conversation

@FineWolf
Copy link
Copy Markdown
Contributor

@FineWolf FineWolf commented Jul 9, 2023

Changes

  • Add new exported types in astro:content in order to allow user spaces services to effectively type content services.
  • CollectionKey allows to target the name of all collections
  • ContentCollectionKey allows to target the name of content collections
  • DataCollectionKey allows to target the name of data collections

There is currently no way to cleanly infer a type that is equivalent to keyof AnyEntryMap in user space. This PR aims to rectify that.

Testing

This is a typing change, no test is currently present to check the generated typings.

Docs

The documentation doesn't currently cover the typings of astro:content.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 9, 2023

🦋 Changeset detected

Latest commit: 31cb628

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 9, 2023
@ematipico
Copy link
Copy Markdown
Member

Since we don't have a documentation page of this kind of stuff, we could use a changelog to show the usage of these new types.

@Princesseuh Princesseuh merged commit 45364c3 into withastro:main Sep 13, 2023
@astrobot-houston astrobot-houston mentioned this pull request Sep 13, 2023
ArmandPhilippot added a commit to ArmandPhilippot/astro-docs that referenced this pull request Jul 29, 2024
* See withastro/astro#7607 for the most recent
exported types
* See withastro/astro#6850 for `reference()`
* See `packages/astro/types/content.d.ts` for `schema` type (might
need a refactor)
* `getDataEntryById` is missing but since `getEntryBySlug` is
announced as deprecated I don't know if we should add it (so
no change here)
ArmandPhilippot added a commit to ArmandPhilippot/astro-docs that referenced this pull request Jul 29, 2024
* See withastro/astro#7607 for the most recent
exported types
* See withastro/astro#6850 for `reference()`
* See `packages/astro/types/content.d.ts` for `schema` type (might
need a refactor)
* `getDataEntryById` is missing but since `getEntryBySlug` is
announced as deprecated I don't know if we should add it (so
no change here)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants