MCPcopy Create free account
hub / github.com/TanStack/query / options

Function options

packages/angular-query/src/__tests__/query-options.test-d.ts:39–54  ·  view source on GitHub ↗
(id: string | null)

Source from the content-addressed store, hash-verified

37 it('should allow undefined response in initialData', () => {
38 const key = createKey()
39 const options = (id: string | null) =>
40 queryOptions({
41 queryKey: [...key, id],
42 queryFn: () =>
43 Promise.resolve({
44 id: '1',
45 title: 'Do Laundry',
46 }),
47 initialData: () =>
48 !id
49 ? undefined
50 : {
51 id,
52 title: 'Initial Data',
53 },
54 })
55
56 expectTypeOf(options(null).initialData).returns.toEqualTypeOf<
57 { id: string; title: string } | undefined

Callers 1

Calls 1

queryOptionsFunction · 0.50

Tested by

no test coverage detected