Skip to content

Conversation

manudeli
Copy link
Collaborator

@manudeli manudeli commented Mar 19, 2024

This change add 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 in https://github.com/TanStack/query/pull/7139/files#diff-e6421be8af92bef480137fd70c8e935fd1975d73ae3a75f393893de5542e2a41

  • 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

Copy link

vercel bot commented Mar 19, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview Mar 22, 2024 10:04am

Copy link

nx-cloud bot commented Mar 19, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 155859b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link

codesandbox-ci bot commented Mar 19, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 155859b:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

Copy link
Collaborator Author

@manudeli manudeli left a comment

Choose a reason for hiding this comment

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

I left my intention

UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
'placeholderData' | 'suspense'
Copy link
Collaborator Author

@manudeli manudeli Mar 19, 2024

Choose a reason for hiding this comment

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

This unnecessary suspense field could be removed by OmitKeyof with correct type error

@manudeli manudeli marked this pull request as ready for review March 19, 2024 18:32
@manudeli manudeli marked this pull request as draft March 21, 2024 04:55
@manudeli manudeli changed the title feat(*): add OmitKeyOf to validate Omitting keys feat(*): add OmitKeyof to Omitting keys strictly Mar 22, 2024
@manudeli manudeli changed the title feat(*): add OmitKeyof to Omitting keys strictly feat(*): add OmitKeyof to Omitting keys strictly Mar 22, 2024
@manudeli manudeli changed the title feat(*): add OmitKeyof to Omitting keys strictly feat(*): add OmitKeyof to Omit keys strictly Mar 22, 2024
@manudeli manudeli changed the title feat(*): add OmitKeyof to Omit keys strictly feat(*): add OmitKeyof to Omit object by object's keys strictly Mar 22, 2024
@manudeli manudeli marked this pull request as ready for review March 22, 2024 09:04
@TkDodo TkDodo merged commit 39b2f81 into TanStack:main Mar 22, 2024
manudeli added a commit to toss/suspensive that referenced this pull request Mar 27, 2024
# Overview

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

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
- https://github.com/TanStack/query/pull/6907/files
- TanStack/query#7139 (comment)

### 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](https://github.com/TanStack/query/assets/61593290/3a3b1743-99cc-41bd-9f51-0a24f8973f87)
- `OmitKeyof` check strictly second type parameter of it by extending
keyof TObject
![Mar-22-2024
18-13-45](https://github.com/TanStack/query/assets/61593290/4204a036-af4f-4d19-b9fe-3aac39069f90)
- `OmitKeyof` prevent library contributors make misspell like queryTey
or qeuryKey
![Mar-22-2024
18-14-35](https://github.com/TanStack/query/assets/61593290/6c7e3ab0-a7bf-420f-a353-292e94297ec2)
- Library users can be supplied with stable types consistently

## 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.
manudeli added a commit to toss/suspensive that referenced this pull request Aug 3, 2024
# Overview

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

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
- https://github.com/TanStack/query/pull/6907/files
- TanStack/query#7139 (comment)

### 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](https://github.com/TanStack/query/assets/61593290/3a3b1743-99cc-41bd-9f51-0a24f8973f87)
- `OmitKeyof` check strictly second type parameter of it by extending
keyof TObject
![Mar-22-2024
18-13-45](https://github.com/TanStack/query/assets/61593290/4204a036-af4f-4d19-b9fe-3aac39069f90)
- `OmitKeyof` prevent library contributors make misspell like queryTey
or qeuryKey
![Mar-22-2024
18-14-35](https://github.com/TanStack/query/assets/61593290/6c7e3ab0-a7bf-420f-a353-292e94297ec2)
- Library users can be supplied with stable types consistently

## 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.
manudeli added a commit to toss/suspensive that referenced this pull request Aug 3, 2024
# Overview

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

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
- https://github.com/TanStack/query/pull/6907/files
- TanStack/query#7139 (comment)

### 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](https://github.com/TanStack/query/assets/61593290/3a3b1743-99cc-41bd-9f51-0a24f8973f87)
- `OmitKeyof` check strictly second type parameter of it by extending
keyof TObject
![Mar-22-2024
18-13-45](https://github.com/TanStack/query/assets/61593290/4204a036-af4f-4d19-b9fe-3aac39069f90)
- `OmitKeyof` prevent library contributors make misspell like queryTey
or qeuryKey
![Mar-22-2024
18-14-35](https://github.com/TanStack/query/assets/61593290/6c7e3ab0-a7bf-420f-a353-292e94297ec2)
- Library users can be supplied with stable types consistently

## 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.
manudeli added a commit to toss/suspensive that referenced this pull request Aug 3, 2024
# Overview

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

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
- https://github.com/TanStack/query/pull/6907/files
- TanStack/query#7139 (comment)

### 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](https://github.com/TanStack/query/assets/61593290/3a3b1743-99cc-41bd-9f51-0a24f8973f87)
- `OmitKeyof` check strictly second type parameter of it by extending
keyof TObject
![Mar-22-2024
18-13-45](https://github.com/TanStack/query/assets/61593290/4204a036-af4f-4d19-b9fe-3aac39069f90)
- `OmitKeyof` prevent library contributors make misspell like queryTey
or qeuryKey
![Mar-22-2024
18-14-35](https://github.com/TanStack/query/assets/61593290/6c7e3ab0-a7bf-420f-a353-292e94297ec2)
- Library users can be supplied with stable types consistently

## 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.
manudeli added a commit to toss/suspensive that referenced this pull request Aug 3, 2024
# Overview

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

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
- https://github.com/TanStack/query/pull/6907/files
- TanStack/query#7139 (comment)

### 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](https://github.com/TanStack/query/assets/61593290/3a3b1743-99cc-41bd-9f51-0a24f8973f87)
- `OmitKeyof` check strictly second type parameter of it by extending
keyof TObject
![Mar-22-2024
18-13-45](https://github.com/TanStack/query/assets/61593290/4204a036-af4f-4d19-b9fe-3aac39069f90)
- `OmitKeyof` prevent library contributors make misspell like queryTey
or qeuryKey
![Mar-22-2024
18-14-35](https://github.com/TanStack/query/assets/61593290/6c7e3ab0-a7bf-420f-a353-292e94297ec2)
- Library users can be supplied with stable types consistently

## 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.

2 participants