page prop is type never with InferGetStaticPropsType as it has no signature matching the paginate function #6507
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
What version of
astro
are you using?2.1.2
Are you using an SSR adapter? If so, which one?
none
What package manager are you using?
npm
What operating system are you using?
windows
What browser are you using?
chrome
Describe the Bug
InferGetStaticPropsType does not work with
getStaticPaths({ paginate } {...}
The new helper type
type Props = InferGetStaticPropsType<typeof getStaticPaths>
does not work when used withgetStaticPaths()
and the paginate option such as the basic docs pagination example found here.See below codesandbox run script
check
The signature infers types from a function with no arguments
T extends () =>...
I tried modifying the signature to accept parameters:
I was specifically trying to use this with collections:
The paginate function appears not to return the collection type of
CollectionEntry<"projects">[]
but instead returns onlytype GetStaticPathsResult
. It would be nice if this were a generic so that inferGetStaticPropsType could infer the collectionEntry as Props.The old way still of course works as expected:
Link to Minimal Reproducible Example
https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/blog?on=codesandbox&file=%2FREADME.md
Participation
The text was updated successfully, but these errors were encountered: