Skip to content
Source
Sign inSign up
TanStack/query

test(angular-query/inject-query): move type assertions from the runtime test back to 'test-d' #12728

Mergedsukvvon(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/12728/headmerged by sukvvon(GitHub profile, opens in a new tab) View on GitHub

sukvvon(GitHub profile, opens in a new tab)commented

🎯 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

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

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.
    1. Pushedb746df5

    2. 🚀 Changeset Version Preview

      2 package(s) bumped directly, 24 bumped as dependents.

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/query-core5.108.4 → 5.108.5Changeset
      @tanstack/query-devtools5.108.4 → 5.108.5Changeset
      @tanstack/angular-query5.108.4 → 5.108.5Dependent
      @tanstack/angular-query-devtools5.108.4 → 5.108.5Dependent
      @tanstack/angular-query-persist-client5.108.4 → 5.108.5Dependent
      @tanstack/eslint-plugin-query5.108.4 → 5.108.5Dependent
      @tanstack/lit-query0.2.44 → 0.2.45Dependent
      @tanstack/preact-query5.108.4 → 5.108.5Dependent
      @tanstack/preact-query-devtools5.108.4 → 5.108.5Dependent
      @tanstack/preact-query-persist-client5.108.4 → 5.108.5Dependent
      @tanstack/query-async-storage-persister5.108.4 → 5.108.5Dependent
      @tanstack/query-broadcast-client-experimental5.108.4 → 5.108.5Dependent
      @tanstack/query-persist-client-core5.108.4 → 5.108.5Dependent
      @tanstack/query-sync-storage-persister5.108.4 → 5.108.5Dependent
      @tanstack/react-query5.108.4 → 5.108.5Dependent
      @tanstack/react-query-devtools5.108.4 → 5.108.5Dependent
      @tanstack/react-query-next-experimental5.108.4 → 5.108.5Dependent
      @tanstack/react-query-persist-client5.108.4 → 5.108.5Dependent
      @tanstack/solid-query5.108.4 → 5.108.5Dependent
      @tanstack/solid-query-devtools5.108.4 → 5.108.5Dependent
      @tanstack/solid-query-persist-client5.108.4 → 5.108.5Dependent
      @tanstack/svelte-query6.4.7 → 6.4.8Dependent
      @tanstack/svelte-query-devtools6.4.7 → 6.4.8Dependent
      @tanstack/svelte-query-persist-client6.4.7 → 6.4.8Dependent
      @tanstack/vue-query5.108.4 → 5.108.5Dependent
      @tanstack/vue-query-devtools6.4.7 → 6.4.8Dependent
    3. size-limit report 📦

      PathSize
      react full11.97 KB (0%)
      react minimal8.71 KB (0%)

Sign in to join this conversation.