🎯 Changes#
Moves the should return the correct types assertions in inject-query.test.ts back into inject-query.test-d.ts.
- The
expectTypeOf assertions (including the one inside getMyDataStringKey) now live in describe('injectQuery') in inject-query.test-d.ts. The @Component wrapper is dropped since test-d files are only type-checked.
- The runtime test is removed, along with the now-unused
expectTypeOf and CreateQueryOptions/OmitKeyof/QueryFunction imports.
- Adds a
@ts-expect-error case for injectQuery<number> with a queryFn returning a string.
- Starts the remaining
inject-query.test-d.ts titles with should.
The angular vitest.config.ts type-checks only **/*.test-d.ts, so a broken assertion in the runtime file was reported as Test Files passed / Type Errors no errors without a test name. In the test-d file it now fails as injectQuery > should return the correct types.
✅ Checklist#
🚀 Release Impact#
Summary by CodeRabbit#
- Tests
- Expanded compile-time coverage for default and inferred query result and error types, explicit generic types, union results, and query-key inference.
- Added checks for generic and broadly typed query functions, including functions returning
Promise<any>, and wrapped query helpers.
- Reworded type-test descriptions for clarity. Existing query behavior tests remain unchanged.
🚀 Changeset Version Preview#
2 package(s) bumped directly, 24 bumped as dependents.
🟩 Patch bumps#
@tanstack/query-core@tanstack/query-devtools@tanstack/angular-query@tanstack/angular-query-devtools@tanstack/angular-query-persist-client@tanstack/eslint-plugin-query@tanstack/lit-query@tanstack/preact-query@tanstack/preact-query-devtools@tanstack/preact-query-persist-client@tanstack/query-async-storage-persister@tanstack/query-broadcast-client-experimental@tanstack/query-persist-client-core@tanstack/query-sync-storage-persister@tanstack/react-query@tanstack/react-query-devtools@tanstack/react-query-next-experimental@tanstack/react-query-persist-client@tanstack/solid-query@tanstack/solid-query-devtools@tanstack/solid-query-persist-client@tanstack/svelte-query@tanstack/svelte-query-devtools@tanstack/svelte-query-persist-client@tanstack/vue-query@tanstack/vue-query-devtools