Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Sep 13, 2023

Conversation

FineWolf
Copy link
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

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
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