Skip to content
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

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

KhraksMamtsov
Copy link
Contributor

support combination predicates and refinements

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Related

  • Related Issue #
  • Closes #

add line to doc

rollback or dtslint tests

return test

fix changelog

fix type

PR fixes

support combination predicates and refinements
Copy link

changeset-bot bot commented Jul 27, 2024

🦋 Changeset detected

Latest commit: 012e62f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
effect Minor
@effect/cli Major
@effect/cluster-browser Major
@effect/cluster-node Major
@effect/cluster-workflow Major
@effect/cluster Major
@effect/experimental Major
@effect/opentelemetry Major
@effect/platform-browser Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/platform Major
@effect/printer-ansi Major
@effect/printer Major
@effect/rpc-http Major
@effect/rpc Major
@effect/schema Major
@effect/sql-d1 Major
@effect/sql-drizzle Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/sql Major
@effect/typeclass Major
@effect/vitest Major

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

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<
Copy link
Contributor

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]

Copy link
Contributor Author

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.

<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]> }>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@github-actions github-actions bot force-pushed the next-minor branch 4 times, most recently from 7518908 to 48af068 Compare July 29, 2024 06:20
@tim-smart tim-smart merged commit 8994461 into Effect-TS:next-minor Jul 29, 2024
11 checks passed
@github-actions github-actions bot mentioned this pull request Jul 29, 2024
github-actions bot pushed a commit that referenced this pull request Jul 29, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
github-actions bot pushed a commit that referenced this pull request Jul 29, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
tim-smart pushed a commit that referenced this pull request Jul 29, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
github-actions bot pushed a commit that referenced this pull request Jul 29, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
github-actions bot pushed a commit that referenced this pull request Jul 30, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
github-actions bot pushed a commit that referenced this pull request Jul 30, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
tim-smart pushed a commit that referenced this pull request Jul 30, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
@github-actions github-actions bot mentioned this pull request Jul 30, 2024
tim-smart pushed a commit that referenced this pull request Jul 30, 2024
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
@KhraksMamtsov KhraksMamtsov deleted the refimenet_1 branch September 25, 2024 09:04
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants