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

fix(react): add OmitKeyof safely and test cases for it #816

Merged
merged 4 commits into from
Mar 27, 2024

Conversation

manudeli
Copy link
Member

@manudeli manudeli commented Mar 24, 2024

Overview

related with TanStack/query#7139

This change update OmitKeyof to validate Omitting keys should be keyof Omitted Object Type

As shown below, the inconvenience of having to manually remove unnecessary fields can be identified early on at the type level with OmitKeyof.

Motivatings

Expectation

I made test-d to type-test OmitKeyof

  • For complex types using Omit, I want to reduce the difficulty of library maintenance for it.
    • OmitKeyof provide autocomplete by extending keyof TObject
      Mar-22-2024 18-12-27
    • OmitKeyof check strictly second type parameter of it by extending keyof TObject
      Mar-22-2024 18-13-45
    • OmitKeyof prevent library contributors make misspell like queryTey or qeuryKey
      Mar-22-2024 18-14-35
  • Library users can be supplied with stable types consistently

PR Checklist

  • I did below actions if need
  1. I read the Contributing Guide
  2. I added documents and tests.

Copy link

changeset-bot bot commented Mar 24, 2024

🦋 Changeset detected

Latest commit: 35369e9

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

This PR includes changesets to release 2 packages
Name Type
@suspensive/react Patch
@suspensive/react-query 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

Copy link

vercel bot commented Mar 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
beta ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 27, 2024 8:30am
main ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 27, 2024 8:30am
visualization 🛑 Canceled (Inspect) Mar 27, 2024 8:30am

Copy link

codecov bot commented Mar 24, 2024

Codecov Report

Merging #816 (35369e9) into main (0b8dfdb) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #816   +/-   ##
=======================================
  Coverage   85.34%   85.34%           
=======================================
  Files          30       30           
  Lines         505      505           
  Branches      114      114           
=======================================
  Hits          431      431           
  Misses         64       64           
  Partials       10       10           
Components Coverage Δ
@suspensive/react 100.00% <100.00%> (ø)
@suspensive/react-query 0.00% <ø> (ø)
@suspensive/react-await 100.00% <ø> (ø)
@suspensive/react-image 23.52% <ø> (ø)

@vercel vercel bot temporarily deployed to Preview – beta March 24, 2024 02:53 Inactive
@manudeli manudeli self-assigned this Mar 24, 2024
Copy link
Member

@minsoo-web minsoo-web left a comment

Choose a reason for hiding this comment

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

Delicious.. I love that user can do Strictly Omit without compromising the existing interface!

@vercel vercel bot temporarily deployed to Preview – beta March 27, 2024 08:30 Inactive
@manudeli manudeli merged commit 33fe78c into main Mar 27, 2024
16 checks passed
@manudeli manudeli deleted the fix/OmitKeyof-detail branch March 27, 2024 08:30
@github-actions github-actions bot mentioned this pull request Mar 27, 2024
manudeli pushed a commit that referenced this pull request Mar 27, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @suspensive/react@1.26.6

### Patch Changes

- [#816](#816)
[`33fe78c`](33fe78c)
Thanks [@manudeli](https://github.com/manudeli)! - fix(react): add
OmitKeyof safely and test cases for it

## @suspensive/react-query@1.26.6

### Patch Changes

- Updated dependencies
\[[`33fe78c`](33fe78c)]:
    -   @suspensive/react@1.26.6

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
manudeli added a commit that referenced this pull request Mar 31, 2024
Same with #816

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/suspensive/react/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants