-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
docsSchema typings conflict with defineCollection typings #767
Comments
Thanks for the report! Presumably a type changed in a recent Astro release. As you noted, I don't think any functionality should break, so it's an issue for type checking only. Might be image metadata related? We had to copy-paste a type related to those at one point, so seems like something that could get out of sync. |
The issue seems to be related to a change in Astro We would need to update the type ImageFunction = () => z.ZodObject<{
src: z.ZodString;
width: z.ZodNumber;
height: z.ZodNumber;
format: z.ZodUnion<
[
z.ZodLiteral<'png'>,
z.ZodLiteral<'jpg'>,
z.ZodLiteral<'jpeg'>,
z.ZodLiteral<'tiff'>,
z.ZodLiteral<'webp'>,
z.ZodLiteral<'gif'>,
z.ZodLiteral<'svg'>,
+ z.ZodLiteral<'avif'>,
]
>;
}>; |
Ahhh, yeah, makes sense. Annoying that we need to sync manually and that this causes type errors depending on Astro version used. Let’s ask if we can get that type to import instead of needing to duplicate it. In the meantime, we can probably do some nice refactors thanks to withastro/astro#8672 and require astro@^3.2 as a breaking change. That would make it safe for us to also update this to include the new
|
Update — I figured it out! #775 It actually seems to be safe to import the |
Oh, clever idea to split the imports! 🧠 |
What version of
starlight
are you using?0.10.2
What version of
astro
are you using?3.1.4
What package manager are you using?
npm
What operating system are you using?
Windows
What browser are you using?
Brave
Describe the Bug
The TypeScript typings for
docsSchema
don't match the typings fordefineCollection
and produce a typing error.Error message:
However, everything builds correctly.
When I remove the function execution of
docsSchema
to satisfy the type requirements, I get a compilation error:So, either the types are incorrect or my project is misconfigured even though I'm following the docs.
Link to Minimal Reproducible Example
No response
Participation
The text was updated successfully, but these errors were encountered: