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

test(vue-query): update vitest type test correctly #6988

Merged
merged 18 commits into from
Mar 9, 2024

Conversation

manudeli
Copy link
Contributor

@manudeli manudeli commented Feb 28, 2024

Reference: https://vitest.dev/guide/testing-types

I convert type testing files as vitest's default *.test-d.tsx file from *.types.test.tsx

image

I am converting *.types.test.ts into vitest *.test-d.ts file one package by one package gradually

Copy link

vercel bot commented Feb 28, 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 9, 2024 5:23pm

Copy link

nx-cloud bot commented Feb 28, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 62ad275. 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


🟥 Failed Commands
nx affected --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build --parallel=3

Sent with 💌 from NxCloud.

Copy link

codesandbox-ci bot commented Feb 28, 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 62ad275:

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

@manudeli manudeli marked this pull request as ready for review February 28, 2024 16:38
@manudeli
Copy link
Contributor Author

manudeli commented Mar 6, 2024

@DamianOsipiuk Could you review this please?

@manudeli manudeli changed the title test(vue-query): use vitest typecheck correctly with *.test-d.ts test(vue-query): update vitest type test correctly Mar 6, 2024
@TkDodo
Copy link
Collaborator

TkDodo commented Mar 9, 2024

@manudeli I think this error is legit, please have a look:

TypeCheckError: '"vue-demi"' has no exported member named 'ToRef'. Did you mean 'toRef'?
 ❯ src/useBaseQuery.ts:12:15

@manudeli
Copy link
Contributor Author

manudeli commented Mar 9, 2024

@manudeli I think this error is legit, please have a look:

TypeCheckError: '"vue-demi"' has no exported member named 'ToRef'. Did you mean 'toRef'?
 ❯ src/useBaseQuery.ts:12:15

@TkDodo
In my opinion, These type-errors occurred inconsistently because of the timing of vue-demi-switch calling
We need to fix test:types script to check type errors consistently first, and resolve these errors afterward. (I need @DamianOsipiuk's help to do them)
I made this Pull Request(#7062) to fix test:types script to check the type errors consistently. So, Could we merge this Pull Request first and do these actions in another Pull Request?

@TkDodo TkDodo merged commit 9da12e2 into TanStack:main Mar 9, 2024
5 of 6 checks passed
@TkDodo
Copy link
Collaborator

TkDodo commented Mar 9, 2024

@manudeli now I merged this PR and the exact same errors show up on main, as well as on other PRs. That wasn't there before. This is unlikely to be a coincidence. Are you sure it's not introduced with this PR ?

There are also new type errors in vue type tests now:

 FAIL  |@tanstack/vue-query| src/__tests__/useQuery.test-d.ts > initialData > Config object overload > TData should always be defined when initialData is provided as an object
TypeCheckError: Type '{ wow boolean; }' does not satisfy the constraint 'never'.
 ❯ src/__tests__/useQuery.test-d.ts:19:40
     17|       )
     18| 
     19|       expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
       |                                        ^
     20|     })

please have a look or I have to revert this merge

@TkDodo
Copy link
Collaborator

TkDodo commented Mar 9, 2024

going to revert for now

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