-
-
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
[Content collections] Support type guards on getCollection()
filter
#5970
Conversation
🦋 Changeset detectedLatest commit: 18f6ea3 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 |
…#5970) * fix: respect type guards from collection filter * chore: changeset
This broke the use of plain boolean filters.
It also doesn’t conceptually make sense to require a type guard. A type guard This is why TypeScript arrays have two |
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]>
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]>
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]>
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]>
Commit dabce6b (#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]> Signed-off-by: Anders Kaseorg <[email protected]>
Changes
getCollection()
filtersTesting
Manual testing
Docs
N/A