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)Solution:Jump to 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
....2 Replies
So it happens only when I use the global variable inside
getStaticPaths
. If I rename the function, it works! 🤯
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
.