-
-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support Refinement
in Preficate.tuple
and Predicate.struct
#3366
Conversation
add line to doc rollback or dtslint tests return test fix changelog fix type PR fixes support combination predicates and refinements
🦋 Changeset detectedLatest commit: 012e62f The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
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 |
7854b34
to
ca11e3b
Compare
packages/effect/src/Predicate.ts
Outdated
export const tuple: { | ||
<T extends ReadonlyArray<Predicate.Any>>( | ||
...elements: T | ||
): true extends { [K in keyof T]: T[K] extends Refinement.Any ? true : false }[number] ? Refinement< |
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.
Would this be better? Then you can remove the intermediate record:
[Extract<A[keyof A], Predicate.Refinement<any, any>>] extends [never]
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.
Yes, It works and more elegant.
packages/effect/src/Predicate.ts
Outdated
<T extends ReadonlyArray<Predicate.Any>>( | ||
...elements: T | ||
): true extends { [K in keyof T]: T[K] extends Refinement.Any ? true : false }[number] ? Refinement< | ||
Readonly<{ [I in keyof T]: T[I] extends Refinement.Any ? Refinement.In<T[I]> : Predicate.In<T[I]> }>, |
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.
Readonly<{ [I in keyof T]: T[I] extends Refinement.Any ? Refinement.In<T[I]> : Predicate.In<T[I]> }>, | |
{ readonly [I in keyof T]: T[I] extends Refinement.Any ? Refinement.In<T[I]> : Predicate.In<T[I]> }, |
You can do it in one pass.
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.
done
7518908
to
48af068
Compare
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
support combination predicates and refinements
Type
Description
Related