@tanstack/vue-query 5.47.0 → 5.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +2 -2
- package/build/legacy/types.d.ts +2 -2
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +2 -2
- package/build/modern/types.d.ts +2 -2
- package/package.json +2 -2
- package/src/__tests__/useQuery.test-d.ts +45 -2
- package/src/types.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["import type { Ref, UnwrapRef } from 'vue-demi'\n\ntype Primitive = string | number | boolean | bigint | symbol | undefined | null\ntype UnwrapLeaf =\n | Primitive\n | Function\n | Date\n | Error\n | RegExp\n | Map<any, any>\n | WeakMap<any, any>\n | Set<any>\n | WeakSet<any>\n\nexport type MaybeRef<T> = Ref<T> | T\n\nexport type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T)\n\nexport type MaybeRefDeep<T> = MaybeRef<\n T extends Function\n ? T\n : T extends object\n ? {\n [Property in keyof T]: MaybeRefDeep<T[Property]>\n }\n : T\n>\n\nexport type NoUnknown<T> = Equal<unknown, T> extends true ? never : T\n\nexport type Equal<TTargetA, TTargetB> = (<T>() => T extends TTargetA\n ? 1\n : 2) extends <T>() => T extends TTargetB ? 1 : 2\n ? true\n : false\n\nexport type DeepUnwrapRef<T> = T extends UnwrapLeaf\n ? T\n : T extends Ref<infer U>\n ? DeepUnwrapRef<U>\n : T extends {}\n ? {\n [Property in keyof T]: DeepUnwrapRef<T[Property]>\n }\n : UnwrapRef<T>\n\nexport type DistributiveOmit<T, TKeyOfAny extends keyof any> = T extends any\n ? Omit<T, TKeyOfAny>\n : never\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["import type { ComputedRef, Ref, UnwrapRef } from 'vue-demi'\n\ntype Primitive = string | number | boolean | bigint | symbol | undefined | null\ntype UnwrapLeaf =\n | Primitive\n | Function\n | Date\n | Error\n | RegExp\n | Map<any, any>\n | WeakMap<any, any>\n | Set<any>\n | WeakSet<any>\n\nexport type MaybeRef<T> = Ref<T> | ComputedRef<T> | T\n\nexport type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T)\n\nexport type MaybeRefDeep<T> = MaybeRef<\n T extends Function\n ? T\n : T extends object\n ? {\n [Property in keyof T]: MaybeRefDeep<T[Property]>\n }\n : T\n>\n\nexport type NoUnknown<T> = Equal<unknown, T> extends true ? never : T\n\nexport type Equal<TTargetA, TTargetB> = (<T>() => T extends TTargetA\n ? 1\n : 2) extends <T>() => T extends TTargetB ? 1 : 2\n ? true\n : false\n\nexport type DeepUnwrapRef<T> = T extends UnwrapLeaf\n ? T\n : T extends Ref<infer U>\n ? DeepUnwrapRef<U>\n : T extends {}\n ? {\n [Property in keyof T]: DeepUnwrapRef<T[Property]>\n }\n : UnwrapRef<T>\n\nexport type DistributiveOmit<T, TKeyOfAny extends keyof any> = T extends any\n ? Omit<T, TKeyOfAny>\n : never\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/build/legacy/types.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Ref, UnwrapRef } from 'vue-demi';
|
|
1
|
+
import { Ref, ComputedRef, UnwrapRef } from 'vue-demi';
|
|
2
2
|
|
|
3
3
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
4
4
|
type UnwrapLeaf = Primitive | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any>;
|
|
5
|
-
type MaybeRef<T> = Ref<T> | T;
|
|
5
|
+
type MaybeRef<T> = Ref<T> | ComputedRef<T> | T;
|
|
6
6
|
type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T);
|
|
7
7
|
type MaybeRefDeep<T> = MaybeRef<T extends Function ? T : T extends object ? {
|
|
8
8
|
[Property in keyof T]: MaybeRefDeep<T[Property]>;
|
package/build/legacy/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Ref, UnwrapRef } from 'vue-demi';
|
|
1
|
+
import { Ref, ComputedRef, UnwrapRef } from 'vue-demi';
|
|
2
2
|
|
|
3
3
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
4
4
|
type UnwrapLeaf = Primitive | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any>;
|
|
5
|
-
type MaybeRef<T> = Ref<T> | T;
|
|
5
|
+
type MaybeRef<T> = Ref<T> | ComputedRef<T> | T;
|
|
6
6
|
type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T);
|
|
7
7
|
type MaybeRefDeep<T> = MaybeRef<T extends Function ? T : T extends object ? {
|
|
8
8
|
[Property in keyof T]: MaybeRefDeep<T[Property]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["import type { Ref, UnwrapRef } from 'vue-demi'\n\ntype Primitive = string | number | boolean | bigint | symbol | undefined | null\ntype UnwrapLeaf =\n | Primitive\n | Function\n | Date\n | Error\n | RegExp\n | Map<any, any>\n | WeakMap<any, any>\n | Set<any>\n | WeakSet<any>\n\nexport type MaybeRef<T> = Ref<T> | T\n\nexport type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T)\n\nexport type MaybeRefDeep<T> = MaybeRef<\n T extends Function\n ? T\n : T extends object\n ? {\n [Property in keyof T]: MaybeRefDeep<T[Property]>\n }\n : T\n>\n\nexport type NoUnknown<T> = Equal<unknown, T> extends true ? never : T\n\nexport type Equal<TTargetA, TTargetB> = (<T>() => T extends TTargetA\n ? 1\n : 2) extends <T>() => T extends TTargetB ? 1 : 2\n ? true\n : false\n\nexport type DeepUnwrapRef<T> = T extends UnwrapLeaf\n ? T\n : T extends Ref<infer U>\n ? DeepUnwrapRef<U>\n : T extends {}\n ? {\n [Property in keyof T]: DeepUnwrapRef<T[Property]>\n }\n : UnwrapRef<T>\n\nexport type DistributiveOmit<T, TKeyOfAny extends keyof any> = T extends any\n ? Omit<T, TKeyOfAny>\n : never\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["import type { ComputedRef, Ref, UnwrapRef } from 'vue-demi'\n\ntype Primitive = string | number | boolean | bigint | symbol | undefined | null\ntype UnwrapLeaf =\n | Primitive\n | Function\n | Date\n | Error\n | RegExp\n | Map<any, any>\n | WeakMap<any, any>\n | Set<any>\n | WeakSet<any>\n\nexport type MaybeRef<T> = Ref<T> | ComputedRef<T> | T\n\nexport type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T)\n\nexport type MaybeRefDeep<T> = MaybeRef<\n T extends Function\n ? T\n : T extends object\n ? {\n [Property in keyof T]: MaybeRefDeep<T[Property]>\n }\n : T\n>\n\nexport type NoUnknown<T> = Equal<unknown, T> extends true ? never : T\n\nexport type Equal<TTargetA, TTargetB> = (<T>() => T extends TTargetA\n ? 1\n : 2) extends <T>() => T extends TTargetB ? 1 : 2\n ? true\n : false\n\nexport type DeepUnwrapRef<T> = T extends UnwrapLeaf\n ? T\n : T extends Ref<infer U>\n ? DeepUnwrapRef<U>\n : T extends {}\n ? {\n [Property in keyof T]: DeepUnwrapRef<T[Property]>\n }\n : UnwrapRef<T>\n\nexport type DistributiveOmit<T, TKeyOfAny extends keyof any> = T extends any\n ? Omit<T, TKeyOfAny>\n : never\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/build/modern/types.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Ref, UnwrapRef } from 'vue-demi';
|
|
1
|
+
import { Ref, ComputedRef, UnwrapRef } from 'vue-demi';
|
|
2
2
|
|
|
3
3
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
4
4
|
type UnwrapLeaf = Primitive | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any>;
|
|
5
|
-
type MaybeRef<T> = Ref<T> | T;
|
|
5
|
+
type MaybeRef<T> = Ref<T> | ComputedRef<T> | T;
|
|
6
6
|
type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T);
|
|
7
7
|
type MaybeRefDeep<T> = MaybeRef<T extends Function ? T : T extends object ? {
|
|
8
8
|
[Property in keyof T]: MaybeRefDeep<T[Property]>;
|
package/build/modern/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Ref, UnwrapRef } from 'vue-demi';
|
|
1
|
+
import { Ref, ComputedRef, UnwrapRef } from 'vue-demi';
|
|
2
2
|
|
|
3
3
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
4
4
|
type UnwrapLeaf = Primitive | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any>;
|
|
5
|
-
type MaybeRef<T> = Ref<T> | T;
|
|
5
|
+
type MaybeRef<T> = Ref<T> | ComputedRef<T> | T;
|
|
6
6
|
type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T);
|
|
7
7
|
type MaybeRefDeep<T> = MaybeRef<T extends Function ? T : T extends object ? {
|
|
8
8
|
[Property in keyof T]: MaybeRefDeep<T[Property]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-query",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.48.1",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue",
|
|
5
5
|
"author": "Damian Osipiuk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@tanstack/match-sorter-utils": "^8.15.1",
|
|
50
50
|
"@vue/devtools-api": "^6.5.1",
|
|
51
51
|
"vue-demi": "^0.14.7",
|
|
52
|
-
"@tanstack/query-core": "5.
|
|
52
|
+
"@tanstack/query-core": "5.48.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describe, expectTypeOf, it } from 'vitest'
|
|
2
|
-
import { reactive } from 'vue-demi'
|
|
2
|
+
import { computed, reactive, ref } from 'vue-demi'
|
|
3
3
|
import { useQuery } from '../useQuery'
|
|
4
4
|
import { queryOptions } from '../queryOptions'
|
|
5
5
|
import { simpleFetcher } from './test-utils'
|
|
6
6
|
import type { OmitKeyof } from '..'
|
|
7
7
|
import type { UseQueryOptions } from '../useQuery'
|
|
8
8
|
|
|
9
|
-
describe('
|
|
9
|
+
describe('useQuery', () => {
|
|
10
10
|
describe('Config object overload', () => {
|
|
11
11
|
it('TData should always be defined when initialData is provided as an object', () => {
|
|
12
12
|
const { data } = reactive(
|
|
@@ -225,4 +225,47 @@ describe('initialData', () => {
|
|
|
225
225
|
}
|
|
226
226
|
})
|
|
227
227
|
})
|
|
228
|
+
|
|
229
|
+
describe('accept ref options', () => {
|
|
230
|
+
it('should accept ref options', () => {
|
|
231
|
+
const options = ref({
|
|
232
|
+
queryKey: ['key'],
|
|
233
|
+
queryFn: simpleFetcher,
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
const query = reactive(useQuery(options))
|
|
237
|
+
|
|
238
|
+
if (query.isSuccess) {
|
|
239
|
+
expectTypeOf(query.data).toEqualTypeOf<string>()
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
it('should accept computed options', () => {
|
|
244
|
+
const options = computed(() => ({
|
|
245
|
+
queryKey: ['key'],
|
|
246
|
+
queryFn: simpleFetcher,
|
|
247
|
+
}))
|
|
248
|
+
|
|
249
|
+
const query = reactive(useQuery(options))
|
|
250
|
+
|
|
251
|
+
if (query.isSuccess) {
|
|
252
|
+
expectTypeOf(query.data).toEqualTypeOf<string>()
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
it('should accept computed query options', () => {
|
|
257
|
+
const options = computed(() =>
|
|
258
|
+
queryOptions({
|
|
259
|
+
queryKey: ['key'],
|
|
260
|
+
queryFn: simpleFetcher,
|
|
261
|
+
}),
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
const query = reactive(useQuery(options))
|
|
265
|
+
|
|
266
|
+
if (query.isSuccess) {
|
|
267
|
+
expectTypeOf(query.data).toEqualTypeOf<string>()
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
})
|
|
228
271
|
})
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Ref, UnwrapRef } from 'vue-demi'
|
|
1
|
+
import type { ComputedRef, Ref, UnwrapRef } from 'vue-demi'
|
|
2
2
|
|
|
3
3
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null
|
|
4
4
|
type UnwrapLeaf =
|
|
@@ -12,7 +12,7 @@ type UnwrapLeaf =
|
|
|
12
12
|
| Set<any>
|
|
13
13
|
| WeakSet<any>
|
|
14
14
|
|
|
15
|
-
export type MaybeRef<T> = Ref<T> | T
|
|
15
|
+
export type MaybeRef<T> = Ref<T> | ComputedRef<T> | T
|
|
16
16
|
|
|
17
17
|
export type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T)
|
|
18
18
|
|