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: content layer typings #12666

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Thodor12
Copy link

@Thodor12 Thodor12 commented Dec 6, 2024

Changes

Added 2 extra typings to the content layer generated typings for reference entries.
Whenever you are using referenced collections the output is a combination of collection + id/slug.
However there are no exported typings for this, meaning users either have to create their own typings for this object, or use some way to extract the typing from any of the exposed functions.

I can still change the names of the 2 added typings if someone has better phrasing for it, it's just what I came up with.

Testing

I used the blog example with minor temporary modifications to see if this worked as intended. Screenshots below
2024-12-06 14_18_10-Author astro - astro - Visual Studio Code
2024-12-06 14_18_26-● BlogPost astro - astro - Visual Studio Code

I got no build errors when doing this.

Docs

I do not think this warrants a docs update as this is a relatively niche usecase, only for people that want to pass referenced objects along components. People that are this invested into doing something like this have probably discovered the typings files themselves and are proficient enough with Typescript.

This won't affect anything for the average user.

Copy link

changeset-bot bot commented Dec 6, 2024

🦋 Changeset detected

Latest commit: 5fc71ed

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 Dec 6, 2024
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.

1 participant