-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Empty Content Collections with defined scema don't generate typescript types #11075
Comments
Are you saying that the reproduction doesn't show the issue you found? |
Massive egg on my face, but yes. I tried to get it to break yesterday but just couldn't. I am however able to do it with the project I'm working on, I can make the repository public so you can poke around if you like. |
Unless it's relatively small would prefer that you reproduce in the example you provided. It's possible that through reducing you'll find out that it's not a bug at all. |
I had to poke it a bit, but I reproduced the issue. Turns out, it's not a problem with the build like I thought, it's a problem with Reproduction steps are load up the codespace, run |
|
That would make sense if a collection didn't have a schema defined, but since it does the type would be known in theory, I would think |
@murl-digital Ah interesting, I am able to replicate with your Stackblitz example by running |
The schema defines the type for the The type where that field is is inferred from your entries, so that type is unknown. The schema type doesn't even get used. I think changing it to a generalization of the inferred types would be great, in this case the |
I just ran into the same issue. I believe this is related to #8336, although it seems to be closed. |
The issue you linked is about a previous behavior where Astro would error if a collection was empty. This issue is about the types being unknown when there's no content |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I want to publish a blank vesion of my website with no content. I already have a schema set up on config.ts, and doing a dev build complains but works no problem. However, running a full production builds throws many typescript errors (specifically that something's of a type unknown) because the type wasn't properly generated. The example I provided should be enough to get the bug to trigger, but I wasn't able to.
What's the expected result?
In this scenario, I would expect a build with no pages, similar to how a dev build works
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-2n2i41
Participation
The text was updated successfully, but these errors were encountered: