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

Content's reference type is not aligned with runtime value #12397

Open
1 task
Takeno opened this issue Nov 7, 2024 · 2 comments
Open
1 task

Content's reference type is not aligned with runtime value #12397

Takeno opened this issue Nov 7, 2024 · 2 comments
Labels
5.0 beta Related to the Astro 5.0 beta feat: content collections Related to the Content Collections feature (scope) needs triage Issue needs to be triaged regression

Comments

@Takeno
Copy link

Takeno commented Nov 7, 2024

Astro Info

Astro                    v5.0.0-beta.7
Node                     v18.18.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When defining collection reference, the type of referenced content is {collection: string; slug: string} but it's runtime value is {collection: string; id: string}

Typescript:

(property) related?: {
    collection: "blog";
    slug: "first-post" | "second-post" | "using-mdx";
} | undefined

Runtime:

{ id: 'second-post', collection: 'blog' }

What's the expected result?

The type should be aligned to runtime value

Link to Minimal Reproducible Example

Takeno/astro-content-reference-type-bug@40f5ffd

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 7, 2024
@Takeno Takeno changed the title Content's reference Content's reference type is not aligned with runtime value Nov 7, 2024
@ematipico ematipico added 5.0 beta Related to the Astro 5.0 beta feat: content collections Related to the Content Collections feature (scope) labels Nov 8, 2024
@ematipico
Copy link
Member

ematipico commented Nov 8, 2024

@Takeno do you experience the same issue in v4? FYI we plan to eventually sunset content collections in favour of content layer. This is going to be probably in v6 (nothing is sure yet), but in v5 we encourage people to use content layer instead.

@Takeno
Copy link
Author

Takeno commented Nov 8, 2024

@ematipico No. I tried with latest v4 and it has slug property at runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 beta Related to the Astro 5.0 beta feat: content collections Related to the Content Collections feature (scope) needs triage Issue needs to be triaged regression
Projects
None yet
Development

No branches or pull requests

2 participants