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

feat(types): allow readonly array in omit function #272

Merged

Conversation

shan-shaji
Copy link
Contributor

@shan-shaji shan-shaji commented Oct 18, 2024

Tip

The owner of this PR can publish a preview release by commenting /publish in this PR. Afterwards, anyone can try it out by running pnpm add radashi@pr<PR_NUMBER>.

Summary

This pull request is an enhancement to the omit function, allowing it to accept readonly array keys. This means that the keys array cannot be modified within the function

Related issue, if any:

#267

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed
  • Related benchmarks have been added or updated, if needed

Does this PR introduce a breaking change?

No

Copy link
Member

@aleclarson aleclarson left a comment

Choose a reason for hiding this comment

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

Hey, thanks for this! Good to see you contributing again. 🙌

expect(result).toEqual({
age: 20,
active: true,
})
})
test('returns object without omitted properties when keys are readonly', () => {
Copy link
Member

Choose a reason for hiding this comment

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

We don't need a runtime test here, since this PR only affects type-checking.

We could add a ”type test”, but this change is simple enough that I think that too would be overkill.

Copy link
Contributor Author

@shan-shaji shan-shaji Oct 18, 2024

Choose a reason for hiding this comment

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

Hey @aleclarson If it's an overkill then I think it's better to remove this test. It's a simple change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove it.

@shan-shaji shan-shaji marked this pull request as ready for review October 18, 2024 18:45
@shan-shaji shan-shaji requested a review from aleclarson October 18, 2024 18:53
@aleclarson aleclarson changed the title feat: allow readonly arrays for omit function feat(types): allow readonly array in omit function Oct 18, 2024
@aleclarson aleclarson merged commit a88fa1b into radashi-org:main Oct 18, 2024
7 checks passed
@aleclarson
Copy link
Member

🎉

This will be released in v12.2.0 (and a beta before then, once I fix the CI script)

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

Successfully merging this pull request may close these issues.

2 participants