-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: Don’t require getCollection()
filter to be a type guard
#5998
Conversation
🦋 Changeset detectedLatest commit: 6ae244d The changes in this PR will be included in the next version bump. 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 |
6588286
to
387e00e
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.
Ahh nice catch, looks good to me! Sorry for the breakage.
d79c05b
to
3448a0a
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.
Eep! I remember testing this case but I'll trust if it broke on your end. Let me know if this nit also solves your issue.
Commit dabce6b (withastro#5970) broke the use of a plain boolean filter. Add an overload similar to TypeScript’s Array#filter overload: https://github.com/microsoft/TypeScript/blob/v4.9.4/lib/lib.es5.d.ts#L1442-L1453 Signed-off-by: Anders Kaseorg <[email protected]>
3448a0a
to
6ae244d
Compare
Changes
Commit dabce6b (#5970) broke the use of a plain boolean filter. Add an overload similar to TypeScript’s
Array#filter
overload.#5970 (comment) (cc @bholmesdev)
Testing
Tested with my company blog, which uses
const posts = await getCollection("posts", (post) => post.data.author === author)
.Docs
No documentation change needed.