Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
5 replies
Benjamin

Global variable `Astro` type is `any` when migrating from v3 to v4

I'm migrating my project from Astro v3 to v4. Now, the linter gives me errors as Astro type is
any
. Any idea what can be wrong?

EDIT: it happens only when I use the global variable inside getStaticPaths. If I rename the function, it works! (see video in the thread)
Screenshot_2023-12-29_at_18.19.14.png
Solution
I had the help of an Astro team member, the bug has been identified, there is like a loop when inferring getStaticPaths. Here are two workarounds:
- Explicit the type returned by getStaticPaths instead of inferring it;
- Use directly import.meta.glob instead of Astro.glob.
Was this page helpful?