query icon indicating copy to clipboard operation
query copied to clipboard

improve useQuery type overload

Open mh-alahdadian opened this issue 3 years ago • 6 comments

mh-alahdadian avatar Jul 24 '22 04:07 mh-alahdadian

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 9401b24318d60cf02903656617173a26cb8cced2:

Sandbox Source
@tanstack/query-example-react-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration

codesandbox-ci[bot] avatar Jul 24 '22 04:07 codesandbox-ci[bot]

please fix the pipeline (prettier)

TkDodo avatar Jul 24 '22 19:07 TkDodo

please fix the pipeline (prettier)

fixed

mh-alahdadian avatar Jul 25 '22 08:07 mh-alahdadian

Codecov Report

Merging #3909 (9401b24) into main (eab6e2c) will increase coverage by 0.45%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3909      +/-   ##
==========================================
+ Coverage   96.36%   96.81%   +0.45%     
==========================================
  Files          45       57      +12     
  Lines        2281     2668     +387     
  Branches      640      784     +144     
==========================================
+ Hits         2198     2583     +385     
- Misses         80       83       +3     
+ Partials        3        2       -1     
Impacted Files Coverage Δ
src/core/mutationObserver.ts
src/core/query.ts
src/react/useMutation.ts
src/core/hydration.ts
src/react/logger.native.ts
src/react/reactBatchedUpdates.ts
src/devtools/useLocalStorage.ts
src/core/retryer.ts
src/devtools/styledComponents.ts
src/react/useIsMutating.ts
... and 92 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e9d62f4...9401b24. Read the comment docs.

codecov-commenter avatar Jul 27 '22 16:07 codecov-commenter

@mh-alahdadian I believe this types improvement requires Typescript 4.2 to work right? Currently we have Types currently require using TypeScript v4.1 or greater Therefore this would be a breaking change and we would need to push it out to next major version.

DamianOsipiuk avatar Aug 01 '22 23:08 DamianOsipiuk

@mh-alahdadian I believe this types improvement requires Typescript 4.2 to work right? Currently we have Types currently require using TypeScript v4.1 or greater Therefore this would be a breaking change and we would need to push it out to next major version.

Did you test it on TS4.1 and it doesn't work ? I don't know if it requires a special new version of TS , if it didn't worked with 4.1 then I think we can wait for next major version release , or we can add multiple .d files to support multiple ts versions

mh-alahdadian avatar Aug 02 '22 12:08 mh-alahdadian

Thanks for the contribution. Our plan is to remove all overloads eventually, and for now, there is no drawback to stick with the current implementation.

TkDodo avatar Aug 11 '22 19:08 TkDodo