Skip to content

Commit 547a9c6

Browse files
ci: apply automated fixes
1 parent 8bde747 commit 547a9c6

3 files changed

Lines changed: 155 additions & 155 deletions

File tree

packages/angular-query-experimental/src/__tests__/inject-query.test-d.ts

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -6,107 +6,107 @@ import type { Signal } from '@angular/core'
66
describe('injectQuery', () => {
77
describe('initialData', () => {
88
describe('Config object overload', () => {
9-
it('TData should always be defined when initialData is provided as an object', () => {
10-
const { data } = injectQuery(() => ({
11-
queryKey: ['key'],
12-
queryFn: () => ({ wow: true }),
13-
initialData: { wow: true },
14-
}))
9+
it('TData should always be defined when initialData is provided as an object', () => {
10+
const { data } = injectQuery(() => ({
11+
queryKey: ['key'],
12+
queryFn: () => ({ wow: true }),
13+
initialData: { wow: true },
14+
}))
1515

16-
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean }>>()
17-
})
16+
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean }>>()
17+
})
18+
19+
it('TData should be defined when passed through queryOptions', () => {
20+
const options = () =>
21+
queryOptions({
22+
queryKey: ['key'],
23+
queryFn: () => {
24+
return {
25+
wow: true,
26+
}
27+
},
28+
initialData: {
29+
wow: true,
30+
},
31+
})
32+
const { data } = injectQuery(options)
33+
34+
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean }>>()
35+
})
1836

19-
it('TData should be defined when passed through queryOptions', () => {
20-
const options = () =>
21-
queryOptions({
37+
it('should be possible to define a different TData than TQueryFnData using select with queryOptions spread into useQuery', () => {
38+
const options = queryOptions({
39+
queryKey: ['key'],
40+
queryFn: () => Promise.resolve(1),
41+
})
42+
43+
const query = injectQuery(() => ({
44+
...options,
45+
select: (data) => data > 1,
46+
}))
47+
48+
expectTypeOf(query.data).toEqualTypeOf<Signal<boolean | undefined>>()
49+
})
50+
51+
it('TData should always be defined when initialData is provided as a function which ALWAYS returns the data', () => {
52+
const { data } = injectQuery(() => ({
2253
queryKey: ['key'],
2354
queryFn: () => {
2455
return {
2556
wow: true,
2657
}
2758
},
28-
initialData: {
59+
initialData: () => ({
2960
wow: true,
30-
},
31-
})
32-
const { data } = injectQuery(options)
33-
34-
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean }>>()
35-
})
61+
}),
62+
}))
3663

37-
it('should be possible to define a different TData than TQueryFnData using select with queryOptions spread into useQuery', () => {
38-
const options = queryOptions({
39-
queryKey: ['key'],
40-
queryFn: () => Promise.resolve(1),
64+
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean }>>()
4165
})
4266

43-
const query = injectQuery(() => ({
44-
...options,
45-
select: (data) => data > 1,
46-
}))
47-
48-
expectTypeOf(query.data).toEqualTypeOf<Signal<boolean | undefined>>()
49-
})
50-
51-
it('TData should always be defined when initialData is provided as a function which ALWAYS returns the data', () => {
52-
const { data } = injectQuery(() => ({
53-
queryKey: ['key'],
54-
queryFn: () => {
55-
return {
56-
wow: true,
57-
}
58-
},
59-
initialData: () => ({
60-
wow: true,
61-
}),
62-
}))
63-
64-
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean }>>()
65-
})
66-
67-
it('TData should have undefined in the union when initialData is NOT provided', () => {
68-
const { data } = injectQuery(() => ({
69-
queryKey: ['key'],
70-
queryFn: () => {
71-
return {
72-
wow: true,
73-
}
74-
},
75-
}))
67+
it('TData should have undefined in the union when initialData is NOT provided', () => {
68+
const { data } = injectQuery(() => ({
69+
queryKey: ['key'],
70+
queryFn: () => {
71+
return {
72+
wow: true,
73+
}
74+
},
75+
}))
7676

77-
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean } | undefined>>()
78-
})
77+
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean } | undefined>>()
78+
})
7979

80-
it('TData should have undefined in the union when initialData is provided as a function which can return undefined', () => {
81-
const { data } = injectQuery(() => ({
82-
queryKey: ['key'],
83-
queryFn: () => {
84-
return {
85-
wow: true,
86-
}
87-
},
88-
initialData: () => undefined as { wow: boolean } | undefined,
89-
}))
80+
it('TData should have undefined in the union when initialData is provided as a function which can return undefined', () => {
81+
const { data } = injectQuery(() => ({
82+
queryKey: ['key'],
83+
queryFn: () => {
84+
return {
85+
wow: true,
86+
}
87+
},
88+
initialData: () => undefined as { wow: boolean } | undefined,
89+
}))
9090

91-
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean } | undefined>>()
92-
})
91+
expectTypeOf(data).toEqualTypeOf<Signal<{ wow: boolean } | undefined>>()
92+
})
9393

94-
it('TData should be narrowed after an isSuccess check when initialData is provided as a function which can return undefined', () => {
95-
const query = injectQuery(() => ({
96-
queryKey: ['key'],
97-
queryFn: () => {
98-
return {
99-
wow: true,
100-
}
101-
},
102-
initialData: () => undefined as { wow: boolean } | undefined,
103-
}))
94+
it('TData should be narrowed after an isSuccess check when initialData is provided as a function which can return undefined', () => {
95+
const query = injectQuery(() => ({
96+
queryKey: ['key'],
97+
queryFn: () => {
98+
return {
99+
wow: true,
100+
}
101+
},
102+
initialData: () => undefined as { wow: boolean } | undefined,
103+
}))
104104

105-
if (query.isSuccess()) {
106-
expectTypeOf(query.data).toEqualTypeOf<Signal<{ wow: boolean }>>()
107-
}
105+
if (query.isSuccess()) {
106+
expectTypeOf(query.data).toEqualTypeOf<Signal<{ wow: boolean }>>()
107+
}
108+
})
108109
})
109-
})
110110

111111
describe('structuralSharing', () => {
112112
it('should be able to use structuralSharing with unknown types', () => {

packages/solid-query/src/__tests__/useQuery.test-d.tsx

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,56 @@ import { queryOptions, useQuery } from '../index'
44
describe('useQuery', () => {
55
describe('initialData', () => {
66
describe('Config object overload', () => {
7-
it('TData should always be defined when initialData is provided as an object', () => {
8-
const { data } = useQuery(() => ({
9-
queryKey: ['key'],
10-
queryFn: () => ({ wow: true }),
11-
initialData: { wow: true },
12-
}))
13-
14-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
15-
})
7+
it('TData should always be defined when initialData is provided as an object', () => {
8+
const { data } = useQuery(() => ({
9+
queryKey: ['key'],
10+
queryFn: () => ({ wow: true }),
11+
initialData: { wow: true },
12+
}))
1613

17-
it('TData should be defined when passed through queryOptions', () => {
18-
const options = queryOptions({
19-
queryKey: ['key'],
20-
queryFn: () => ({ wow: true }),
21-
initialData: { wow: true },
14+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
2215
})
23-
const { data } = useQuery(() => options)
2416

25-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
26-
})
17+
it('TData should be defined when passed through queryOptions', () => {
18+
const options = queryOptions({
19+
queryKey: ['key'],
20+
queryFn: () => ({ wow: true }),
21+
initialData: { wow: true },
22+
})
23+
const { data } = useQuery(() => options)
2724

28-
it('TData should always be defined when initialData is provided as a function which ALWAYS returns the data', () => {
29-
const { data } = useQuery(() => ({
30-
queryKey: ['key'],
31-
queryFn: () => ({ wow: true }),
32-
initialData: () => ({ wow: true }),
33-
}))
25+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
26+
})
3427

35-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
36-
})
28+
it('TData should always be defined when initialData is provided as a function which ALWAYS returns the data', () => {
29+
const { data } = useQuery(() => ({
30+
queryKey: ['key'],
31+
queryFn: () => ({ wow: true }),
32+
initialData: () => ({ wow: true }),
33+
}))
3734

38-
it('TData should have undefined in the union when initialData is NOT provided', () => {
39-
const { data } = useQuery(() => ({
40-
queryKey: ['key'],
41-
queryFn: () => ({ wow: true }),
42-
}))
35+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
36+
})
4337

44-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
45-
})
38+
it('TData should have undefined in the union when initialData is NOT provided', () => {
39+
const { data } = useQuery(() => ({
40+
queryKey: ['key'],
41+
queryFn: () => ({ wow: true }),
42+
}))
43+
44+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
45+
})
4646

47-
it('TData should have undefined in the union when initialData is provided as a function which can return undefined', () => {
48-
const { data } = useQuery(() => ({
49-
queryKey: ['key'],
50-
queryFn: () => ({ wow: true }),
51-
initialData: () => undefined as { wow: boolean } | undefined,
52-
}))
47+
it('TData should have undefined in the union when initialData is provided as a function which can return undefined', () => {
48+
const { data } = useQuery(() => ({
49+
queryKey: ['key'],
50+
queryFn: () => ({ wow: true }),
51+
initialData: () => undefined as { wow: boolean } | undefined,
52+
}))
5353

54-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
54+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
55+
})
5556
})
56-
})
5757

5858
describe('Query key overload', () => {
5959
it('TData should always be defined when initialData is provided', () => {

packages/svelte-query/tests/createQuery.test-d.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,46 @@ import { createQuery, queryOptions } from '../src/index.js'
44
describe('createQuery', () => {
55
describe('initialData', () => {
66
describe('Config object overload', () => {
7-
it('TData should always be defined when initialData is provided as an object', () => {
8-
const { data } = createQuery(() => ({
9-
queryKey: ['key'],
10-
queryFn: () => ({ wow: true }),
11-
initialData: { wow: true },
12-
}))
13-
14-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
15-
})
7+
it('TData should always be defined when initialData is provided as an object', () => {
8+
const { data } = createQuery(() => ({
9+
queryKey: ['key'],
10+
queryFn: () => ({ wow: true }),
11+
initialData: { wow: true },
12+
}))
1613

17-
it('TData should be defined when passed through queryOptions', () => {
18-
const options = queryOptions({
19-
queryKey: ['key'],
20-
queryFn: () => ({ wow: true }),
21-
initialData: { wow: true },
14+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
2215
})
23-
const { data } = createQuery(() => options)
2416

25-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
26-
})
17+
it('TData should be defined when passed through queryOptions', () => {
18+
const options = queryOptions({
19+
queryKey: ['key'],
20+
queryFn: () => ({ wow: true }),
21+
initialData: { wow: true },
22+
})
23+
const { data } = createQuery(() => options)
2724

28-
it('TData should have undefined in the union when initialData is NOT provided', () => {
29-
const { data } = createQuery(() => ({
30-
queryKey: ['key'],
31-
queryFn: () => ({ wow: true }),
32-
}))
25+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean }>()
26+
})
3327

34-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
35-
})
28+
it('TData should have undefined in the union when initialData is NOT provided', () => {
29+
const { data } = createQuery(() => ({
30+
queryKey: ['key'],
31+
queryFn: () => ({ wow: true }),
32+
}))
33+
34+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
35+
})
3636

37-
it('TData should have undefined in the union when initialData is provided as a function which can return undefined', () => {
38-
const { data } = createQuery(() => ({
39-
queryKey: ['key'],
40-
queryFn: () => ({ wow: true }),
41-
initialData: () => undefined as { wow: boolean } | undefined,
42-
}))
37+
it('TData should have undefined in the union when initialData is provided as a function which can return undefined', () => {
38+
const { data } = createQuery(() => ({
39+
queryKey: ['key'],
40+
queryFn: () => ({ wow: true }),
41+
initialData: () => undefined as { wow: boolean } | undefined,
42+
}))
4343

44-
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
44+
expectTypeOf(data).toEqualTypeOf<{ wow: boolean } | undefined>()
45+
})
4546
})
46-
})
4747

4848
describe('Query key overload', () => {
4949
it('TData should always be defined when initialData is provided', () => {

0 commit comments

Comments
 (0)