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

Improve Struct pick to support optional properties #2130

Closed
wants to merge 1 commit into from

Conversation

evelant
Copy link

@evelant evelant commented Feb 14, 2024

Makes pick behave more consistently. Allow picking optional properties and have them as optional in the result.

dtslint complains about this change, I'm not sure how to interpret the results however, happy to make any necessary changes

Copy link

changeset-bot bot commented Feb 14, 2024

🦋 Changeset detected

Latest commit: d110473

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

This PR includes changesets to release 15 packages
Name Type
effect Patch
@effect/cli Patch
@effect/experimental Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/platform Patch
@effect/printer-ansi Patch
@effect/printer Patch
@effect/rpc-http Patch
@effect/rpc Patch
@effect/schema Patch
@effect/typeclass Patch

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

@evelant
Copy link
Author

evelant commented Feb 14, 2024

Fixed dtslint errors

@mikearnaldi mikearnaldi requested review from gcanti and removed request for mikearnaldi February 15, 2024 15:44
@evelant evelant changed the title Improve types of Struct pick to support optional properties Improve Struct pick to support optional properties Feb 15, 2024
Copy link
Contributor

@gcanti gcanti left a comment

Choose a reason for hiding this comment

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

The proposed change will modify the runtime behavior. While I'm ok with this change, it's advisable to include it in the next minor release.

Additionally, if we modify the behavior, we can utilize the built-in Pick type, eliminating the necessity for additional type helpers to obtain the optional properties.

I've submitted a PR to the next-minor branch, along with some tests (#2161).

@evelant
Copy link
Author

evelant commented Feb 15, 2024

👍 Thanks for improving on my work, I don't know why I didn't think to just use Pick instead of adding a helper.

@evelant evelant closed this Feb 15, 2024
@narley
Copy link

narley commented Feb 19, 2024

Thank you both for giving some tlc on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants