-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix/numeric path params #3087
Fix/numeric path params #3087
Conversation
🦋 Changeset detectedLatest commit: e4b5509 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
a6474d7
to
3ee391e
Compare
3ee391e
to
e4b5509
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally unenc(n)umbered by bad type checks 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice QoL improvement! LGTM.
A PR merged back in April changed the type of Params, allowing numbers to be provided in addition to strings. See withastro#3087. However, as said PR changed the type of Params instead of GetStaticPathsItem, it also affects Astro.params. This commit moves the change to GetStaticPathsItem, reverting the type of Astro.params.
A PR merged back in April changed the type of Params, allowing numbers to be provided in addition to strings. See withastro#3087. However, as said PR changed the type of Params instead of GetStaticPathsItem, it also affects Astro.params. This commit moves the change to GetStaticPathsItem, reverting the type of Astro.params.
A PR merged back in April changed the type of Params, allowing numbers to be provided in addition to strings. See #3087. However, as said PR changed the type of Params instead of GetStaticPathsItem, it also affects Astro.params. This commit moves the change to GetStaticPathsItem, reverting the type of Astro.params.
* adding support for numeric params in getStaticPaths() * chore: adding changeset * ignore undefined params in type validation
Changes
Adds support for numeric route parameters in
getStaticPaths()
, for example when including years/months/days in a blog post URLThis also adds type validation for route parameters to throw an error when
getStaticPaths()
is given a parameter that isn't a string or numberTesting
getStaticPaths()
test updated to include a route using a number for theyear
parameterDocs
Related docs PR #345