-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(types): allow readonly array in omit
function
#272
Conversation
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.
Hey, thanks for this! Good to see you contributing again. 🙌
tests/object/omit.test.ts
Outdated
expect(result).toEqual({ | ||
age: 20, | ||
active: true, | ||
}) | ||
}) | ||
test('returns object without omitted properties when keys are readonly', () => { |
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.
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.
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.
Hey @aleclarson If it's an overkill then I think it's better to remove this test. It's a simple change.
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.
I will remove it.
omit
function
🎉 This will be released in v12.2.0 (and a beta before then, once I fix the CI script) |
Tip
The owner of this PR can publish a preview release by commenting
/publish
in this PR. Afterwards, anyone can try it out by runningpnpm 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 functionRelated issue, if any:
#267
For any code change,
Does this PR introduce a breaking change?
No