vue-query
vue-query copied to clipboard
Typescript compilation fails with v2 beta.5
A few direct imports from @tanstack/query-core/src source code cause strict mode Typescript compilations to fail:
../../node_modules/@tanstack/query-core/src/focusManager.ts:16:18 - error TS7030: Not all code paths return a value.
16 this.setup = (onFocus) => {
~~~~~~~~~~~~~~
../../node_modules/@tanstack/query-core/src/infiniteQueryBehavior.ts:187:4 - error TS7030: Not all code paths return a value.
187 ): boolean | undefined {
~~~~~~~~~~~~~~~~~~~
../../node_modules/@tanstack/query-core/src/infiniteQueryBehavior.ts:205:4 - error TS7030: Not all code paths return a value.
205 ): boolean | undefined {
~~~~~~~~~~~~~~~~~~~
../../node_modules/@tanstack/query-core/src/onlineManager.ts:16:18 - error TS7030: Not all code paths return a value.
16 this.setup = (onOnline) => {
~~~~~~~~~~~~~~~
../../node_modules/@tanstack/query-core/src/retryer.ts:184:17 - error TS7030: Not all code paths return a value.
184 .then(() => {
~~~~~~~
../../node_modules/@tanstack/query-core/src/utils.ts:417:39 - error TS7030: Not all code paths return a value.
417 export function getAbortController(): AbortController | undefined {
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 6 errors in 5 files.
tsc --noEmit --noImplicitReturns --skipLibCheck
In this case the skipLibCheck does not help as vue-query declaration files are accessed directly and query-core references are not declaration files. For some reason @tanstack/query repo has only the offending strict mode flag turned off
Looks like QueryState and Updater need to be exposed upstream, otherwise correct type imports look ugly like this:
import type { QueryState } from "@tanstack/query-core/build/types/packages/query-core/src/query";
import type { Updater } from "@tanstack/query-core/build/types/packages/query-core/src/utils";
Will be fixed here: https://github.com/TanStack/query/pull/3892
Should be fixed in https://github.com/DamianOsipiuk/vue-query/releases/tag/v2.0.0-beta.10
Confirmed, thanks!